How to make Java Application?

How to make Java Application?

All the Java programs can be divided into two groups – Applications and Applets. The basic difference is that Application can be executed at command (DOS) prompt and Applet executes in a Browser. Here, we are concerned with Java Application.

There are three steps to write Java Application – Writing source code, Compilation and Execution.

I. Writing Source Code for Java Application

Java comes with many IDEs to write the source code. For simplicity, we use notepad editor to write the source code.

Open command prompt and open a file as follows.

C:\snr> notepad

The above statement opens a notepad on the file name The extension of every Java file should be .java like you have .C for every C program.

Java ApplicationOutput Screenshot on Java Application

II. Compilation of Java Application

Next step is to compile the above file called containing source code. Come to the command prompt and type.

C:\snr> javac

javac stands for Java Compiler. It is an instruction to compiler to compile the file called If no errors exist, after compilation, the compiler generates a file Demo.class. Demo.class is the executable file equivalent to .exe file of C-lang. Demo.class file contains bytecode that makes Java platform-independent.

III. Execution of Java Application

After generating .class file, next step is execution.

C:\snr> java Demo

In the above statement, java is the execution command which executes and gets output at command prompt. See the above Screenshot.

A similar example is available, read for more: Java Example Compilation Execution

Leave a Reply

Your email address will not be published. Required fields are marked *