A First Simple Program
/*This is first simple Java program
Call this file Example,java*/
class Example
{
public static void main(String args[])
{
System.out.println("This is a Simple java program");
}
}
---------------------------------------------
Entering the program
--------------------------------------------------------
Compiling the program
To compile the Example program, execute the compiler, javac , specifying source file on the command line as shown here
c:\>javac Example.java
The javac compiler creates a file called Example.class that contains bytecode version program. As discussed earlier, the Java Bytecode is the intermedia representation representation of your program that contains instructions that Java Virtual machine will execute
Thus output of javac is not code that can be directly executed.
To actually run the program, you must use the application launcher called java. To do so, pass the class name Example as a Command -line argument, as shown here.
c:\>java Example
Output:This is a Simple java program
---------------------------------------------------------
A closer look
--------------------------------------------------------
/*This is first simple Java program
Call this file Example,java*/
class Example
{
public static void main(String args[])
{
System.out.println("This is a Simple java program");
}
}
---------------------------------------------
Entering the program
--------------------------------------------------------
Compiling the program
To compile the Example program, execute the compiler, javac , specifying source file on the command line as shown here
c:\>javac Example.java
The javac compiler creates a file called Example.class that contains bytecode version program. As discussed earlier, the Java Bytecode is the intermedia representation representation of your program that contains instructions that Java Virtual machine will execute
Thus output of javac is not code that can be directly executed.
To actually run the program, you must use the application launcher called java. To do so, pass the class name Example as a Command -line argument, as shown here.
c:\>java Example
Output:This is a Simple java program
---------------------------------------------------------
A closer look
--------------------------------------------------------
No comments:
Post a Comment