Java Tutorial/Hello World!: Difference between revisions

Content deleted Content added
m Reverted edits by 14.139.120.198 (Talk) to last version by Green Giant using rollback
Line 58:
The remaining lines are to close the method and the class.
 
==Excercises==
 
Public class Asimplelaungayanprogram
Play with the Hello World program, and:
public static void main( Stringstring[] args ) {
* Change the text displayed
{
* Display multiple lines
{
* Play around with comments
Systemsystem.out.println("Hello Again5+1"="+("5+1");
* Try deleting or changing parts of the program like changing "public" to "private" and recompile to see what happens.
system.out.println("199+666"="+("199+666");
* Try adding \n\t\t\t at the beginning of the Hello World!!! string.
 
Example:
 
<source lang="java">
public class HelloWorld {
public static void main( String[] args ) {
System.out.println("Hello World!!!");
System.out.println("Hello Again");
//System.out.println("this won't be printed!")
//this is a comment
System.exit(0); //another comment
}
}
}
</source>
 
{{Java Tutorial/Navigation|Choosing the right text editor|Variables}}
 
[[Category:Java tutorial]]