Hi, now i am going to post about the java language and some basic programs on it. these programs may be useful for the graduate level core java. In parallel i will post the programs for the advanced level.Now as a basic programmer you need to implement the experiments on the programs by modification on statements while in the execution process
To do this you require to install the software called " jdk for java se(standard edition)" availiable at .
http://www.oracle.com/technetwork/java/javase/downloads/index.htmland notepad as a text editor.
As a formality i am posting "Hello World!" as a starting program
class HelloWorldExample{
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
--EVERY PROGRAM IN JAVA ARE IN THE FORM OF CLASSES
that's why we used "class" as starting line with the unique name for its class as "HelloworldExample"
--Next one is MAIN METHOD
In the Java programming language, every application must contain a
main
method whose signature is:
public static void main(String[] args)
The modifiers public and static can be written in either order (public static or static public), but the convention is to use public static as shown above. You can name the argument anything you want, but most programmers choose "args" or "argv". Here the main method is an entrance to the program, so absolutely it is required.
public
indicates that the main()
method can be called by any object.
static
indicates that the main()
method is a class method.
void
indicates that the main()
method has no return value. compile it withjavac HelloWorldExample.java
run it with the command
java HelloWorldExample
The output can be
Hello World!
That's about the basic story of a hello world program in java. If you know more explanation please post it in comments.
Read More...