S
Stefan Ram
»class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
«
http://docs.oracle.com/javase/tutorial/getStarted/cupojava/win32.html
There is no »public« in front of »class« in Oracles Tutorial!
What should I teach in my classes?
1.) »public class HelloWorldApp« (because this is most common IIRC)
2.) »class HelloWorldApp« (because this is in Oracles tutorial)
3.) »final class HelloWorldApp« (because this class is not designed
for inheritance and Bloch says that one should not inherit from
it in this case and the students can as well get used to this
right from the start)
4.) »public final class HelloWorldApp« (combination of »1.)« and »3.)«)
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
«
http://docs.oracle.com/javase/tutorial/getStarted/cupojava/win32.html
There is no »public« in front of »class« in Oracles Tutorial!
What should I teach in my classes?
1.) »public class HelloWorldApp« (because this is most common IIRC)
2.) »class HelloWorldApp« (because this is in Oracles tutorial)
3.) »final class HelloWorldApp« (because this class is not designed
for inheritance and Bloch says that one should not inherit from
it in this case and the students can as well get used to this
right from the start)
4.) »public final class HelloWorldApp« (combination of »1.)« and »3.)«)