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.html
and 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: 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 static void main(String[] args)
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 with
javac HelloWorldExample.java
run it with the command
java HelloWorldExample
The output can beThat's about the basic story of a hello world program in java. If you know more explanation please post it in comments.
Hello World!
0 komentar:
Post a Comment