A simple program on Java
,that displays a message.class FirstProgram
{
public static void main(String args[]) //main method
{
System.out.println(“Welcome to Java 4r beginners”); /* will be printed on output*/
System.out.println(“This Simple Java program”)
}
}
/*
now save this program with “FirstProgram.java” as class name is FirstProgram.
-Program should be saved with its class name.
Compilation:
You need to set the path first click here to know how to set path.
-After setting path, C:\javaprograms>javac FirstProgram.java
Here dot class file will be created.You can see this in the folder u saved.(I saved in javaprograms folder)
Run the program:
C:\javaprograms>java FirstProgram
out put will be displayed.
*/
I recommend to use Java IDE for java programs.
It helps a lot than the text editors.Here see how to Compile in Eclipse IDE.
See what is package
No comments:
Post a Comment