First of all we create a main class like
public class HelloWorld
{
public static void main(String [] arg)
{
//we have to print "Hello World " in the terminal window.
System.out.println("Hello World");
}
}
and save it as the class name with first capital letter as HelloWorld.java .
If we run this program the output is Hello World, to run this program open cmd in bin and type javac file_name .java and hit enter you compiled it now you can run it by typing java file_name.
public class HelloWorld
{
public static void main(String [] arg)
{
//we have to print "Hello World " in the terminal window.
System.out.println("Hello World");
}
}
and save it as the class name with first capital letter as HelloWorld.java .
If we run this program the output is Hello World, to run this program open cmd in bin and type javac file_name .java and hit enter you compiled it now you can run it by typing java file_name.
No comments:
Post a Comment