Helloworld.java
Simple HelloWorld Example:
Following is a simple example to start your coding practices...
Class HelloWorld {
public static void main(String args[] ) {
system.out.println("Hello World!");
}
}
You have to save the above code in file named "HelloWorld.java" because java language is case sensitve even if your operating system is not case sensitive like MS Windows.
Why java language source code file names are case sensitive? Why we need to save the above code only with "HelloWorld.java" name?
As our class name is "HelloWorld" with H and W capital letters so as java language compiler which compiles the java language source code into byte code is case sensitive even on those operation systems which has no case distinction in file names.
When the compiler runs and compiles the .java file into .class files it will generate the resultant byte code file name in the same manner as the source code file, so the compilation of HelloWorld.java will produce the HelloWorld.class file after compilation. |