For now this changes nothing. The name of the source code file appears not to matter. However it will matter a great deal in the not too distant future so don't go arbitrarily changing the names of your .java files.
For now this changes nothing. The name of the source code file appears not to matter. However it will matter a great deal in the not too distant future so don't go arbitrarily changing the names of your .java files.
In French:
class HelloWorld {
public static void main (String args[]) {
System.out.println("Bonjour Monde!");
}
}
In Spanish:
class HelloWorld {
public static void main (String args[]) {
System.out.println("Hola Mundo!");
}
}
In Latin:
class HelloWorld {
public static void main (String args[]) {
System.out.println("Vale Mundum!");
}
}
In other words, you only translate the String, not the
code itself. Java is still an English based
langauge. Arabic's impossible in Java 1.0 because of the alphabet problem.
It may be possible in future releases using Unicode escapes.
(See Chapter 5).
/* THIS PROGRAM CANNOT BE EXECUTED
WITHOUT SYSADMIN PRIVILEGES */
Absolutely nothing. These lines are comments. They have no effect on the final output.
All you need to do is change the word World to your name. For example
class HelloWorld {
public static void main (String args[]) {
System.out.println("Hello Rusty!");
}
}
You may of course use your own name instead of Rusty.
Hello World! It's been nice knowing you. Goodbye world!This is three lines of text so it needs three System.out.println() statements. In other words:
class HelloWorld {
public static void main (String args[]) {
System.out.println("Hello World!");
System.out.println("It's been nice knowing you.");
System.out.println("Goodbye world!");
}
}
C programmer's can note that \n works in Java just like it works in C
so you could also write
class HelloWorld {
public static void main (String args[]) {
System.out.println("Hello World!\nIt's been nice knowing you.\nGoodbye world!");
}
}
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *Now modify it to draw them next to each other like above.
class DrawPicture1 {
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("* * * * *");
}
}
and
class DrawPicture2 {
public static void main (String args[]) {
System.out.println("* * * * * * ");
System.out.println("* * * * * * * ");
System.out.println("* * * * * * * *");
System.out.println("* * * * * * * * * *");
}
}