/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
-------------------------------------------------------------------------
Comments - text to be ignored by compiler
have to written between /*
'class' is like a package name in PL/SQL and is always a must. Begin and End of a class are denoted by curly brazes.
class followed by application name is the general convention.
Every application must contain a main method - this is similar to a procedure in pl/sql.
public static void main(String[] args) {
System.out.println("Hello World!");
}
Note the declaration - enclosed within the round bracket are the parameters passed to the method.
String[] args -- is a declaration for an array of input strings; 'args' is just a name to the input array and not a key word.
System.out.println("Hello World!") - syntax to print messages on the screen. println method exists in the System class and hence called using the mentioned syntax.
That concludes Lesson2
No comments:
Post a Comment