Java – Application Structure

Java application structure:

  • Java application is a collection of Source files.
  • Source file consists one or more classes.
  • Class contains Variables and Methods.
  • Java application runs by JVM.
  • JVM invoke main() method to start application execution.
  • Application starts with one class in which main() method has defined.

How to Compile and Run Java program from command Prompt?

  1. Open Notepad, Write Code and Save file with .java extension.
  2. Open Command prompt(CUI based OS).
  3. Go to file location.
  4. Compile using command – javac
  5. Run using – java

Code.java:

public class Code
{
            public static void main(String[] args)
            {
                        System.out.println(“Hello World!”);
            }
}

Command Prompt as follows:

Scroll to Top