Implementing a Java Program - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript Implementing a Java Program - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Saturday, March 9, 2019

Implementing a Java Program

Implementing a Java Program


Creating a java program
Compiling a java program
Running the program

Creating a Java Program:

All java source file has an extension .java.

If a program contains multiple classes, the file name must 
be the class name of the class containing the main method.

 This class must be the only public class.

[Rule: File name should match the name of the public class
 of a source code.]

Implementing a Java Program

Compiling a Java Program:



üTo compile a java program, execute the java
 compiler javac, specifying the name of the source
 file on the command line.   C:\> javac 

Example.java

üWhen java source code is compiled, each 
individual class is put into its own output file
 named after the class and using the .class 
extension.

üEach file with .class extension contains the 
bytecode corresponding to that class.

üTo run the program, interpreter java is used the name of the
 class that contains the main function.

  c:\> java Example

üActually it searches for Example. class file.


No comments:

Post a Comment

Post Top Ad