Tuesday, January 4, 2011

First Lab of Software Technology II subject

For the whole first year, we learned C++. This year we learn Java for the subject 'Software Technology II'. Today we had the very first lab session for this subject. I could complete all the lab exercises within the lab session it-self. Special Thanks to the authors of the blog 'අපි Java ඉගෙන ගනිමු'. During my 2 months holiday after the 1st year 2nd semester exam, I went through that blog and learned the basic syntax of Java.

class Exercise1
{
public static void main(String args[])
{
System.out.println();
System.out.println("Hello World !");

System.out.println();

System.out.println("It's been nice knowing you.");

System.out.println();

System.out.println("Goodbye world !");

System.out.println();
}
}




class Exercise2
{
public static void main(String args[])
{

System.out.println("======================================");
System.out.println();
System.out.println("=         Student Information        =");
System.out.println(); 
System.out.println("======================================");
System.out.println();
System.out.println("= Name        :  ARDP Ranasinghe     =");
System.out.println();
System.out.println("= Reg No      :  DIS\\08\\M4\\1234      =");
System.out.println();
System.out.println("= Address     :  Malabe              =");
System.out.println();
System.out.println("======================================");
}
}


class Exercise3
{
public static void main(String args[])
{
System.out.println();
System.out.println();

System.out.println("* * * * *");
System.out.println();
System.out.println("* * * * *");
System.out.println();
System.out.println("* * * * *");
System.out.println();
System.out.println("* * * * *");
System.out.println();
System.out.println();
System.out.println("    *");
System.out.println();
System.out.println("   * *");
System.out.println();
System.out.println("  * * *" );
System.out.println();
System.out.println(" * * * *");
System.out.println();
System.out.println();

}
}




class Exercise4
{
public static void main(String args[])
{
System.out.println();
System.out.println();

System.out.println("* * * * *          *");
System.out.println();
System.out.println("* * * * *         * * ");
System.out.println();
System.out.println("* * * * *        * * *");
System.out.println();
System.out.println("* * * * *      * * * * *");

System.out.println();
System.out.println();
}

}

class Exercis3loops
{
public static void main(String args[])
{
System.out.println();
System.out.println();

for(int row=1; row<=4; row++)
{

for(int i=1; i<=5; i++)
{
System.out.print("* ");
}
System.out.println();
}

System.out.println();


for(int r=1; r<=5; r++)
{
for(int x=6; x>=r; x--)
{
System.out.print(" ");
}

for(int s=1; s<=r; s++)
System.out.print("* ");

System.out.println();
}

System.out.println();
}
}

P.S - Recently I closed the blog as I was continuously receiving bad comments from 'Anonymous' people. But after much thought I decided to continue writing my blog.

-Tharindu Edirisinghe-
-SLIIT 10'-

5 comments:

Kanishka Dilshan said...

Nice.......
Disable Anonymous comments and use comment moderation feature.

Kanishka Dilshan said...

This is a great resource for new SLIIT students.
Thank you malli!

Tharindu Edirisinghe said...

Thanks aiyaa. Your blog is a great resource to learn Java.

Anonymous said...

ados this is an maxxa work.. keep it up bro.

Niranga Jayakody(c2)

Unknown said...

ela machoo !!!!!

Post a Comment