Write various steps to create and compile Java Program?



Ceating the Program
1.       We can create a program using any text editor.
2.      We must save the program in a file called filename.java ensuring that the filename contains the class name properly. The file is called the source file.
3.      The java source files will have the extension java Note that is a program contains multiple classes, the file name must be the classname of the class containing the main method.



Compiling the program
1.       To compile the program, we must run the Java Compiler, with the name of the source file in the command line as showm
javac filename
2.      If everything is OK, the javac compiler creates a file called first.class containing the bytecodes of the program.The compiler automatically names the bytecode file as
<classname> .class
Running the program
1.       We need to use the Java interpreter to run a stand-alone program.At the command prompt,type
java filename
2.      Now, the interpreter looks for the main method in the program and begins execution from there.

Comments

Post a Comment

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart