📢 Join My WhatsApp Channel JavaWithSumit

Get Daily ICSE Java Notes, Programs & Exam Tips 🚀

👉 Join Now

Introduction of Java

Part 1: Introduction to Java 

Java is a high-level, object-oriented programming language prescribed in the ICSE Class 10 Computer Applications syllabus. It helps students learn programming in a structured and logical way while preparing them for board examinations.
Java was developed by Sun Microsystems in 1995 and is now maintained by Oracle. One of its most powerful features is platform independence, meaning a Java program can run on any system using the Java Virtual Machine (JVM).

For ICSE students, Java focuses on logic building, program structure, and problem-solving, rather than just memorizing syntax. Topics like loops, arrays, strings, and methods are frequently asked in exams, making Java a high-scoring subject.

Types of Java Programs :

1. Applet Programs and Application Programs

In this article, we will clearly explain:


What is a Java Application Program?

A Java Application Program is a standalone program that runs independently on a computer using the Java Virtual Machine (JVM).

These programs contain the main() method and are executed using the command prompt or IDE like BlueJ.

Key Features of Application Programs

✔ Contains public static void main(String args[])
✔ Runs independently
✔ Can take input from user
✔ Uses Scanner class
✔ Mostly used in ICSE syllabus


Example of Java Application Program

import java.util.Scanner; class Addition { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.print("Enter first number: "); int a = sc.nextInt(); System.out.print("Enter second number: "); int b = sc.nextInt(); int sum = a + b; System.out.println("Sum = " + sum); } }

📌 This type of program is commonly asked in ICSE practical exams.


What is a Java Applet Program?

A Java Applet is a small Java program that runs inside a web browser or applet viewer. It does not use the main() method.

Applets are mainly used to create:

  • Graphics

  • Animations

  • Drawing shapes

  • Interactive web applications

⚠️ Note: Modern browsers do not support applets, but they are still important for ICSE theory knowledge.


Key Features of Applet Programs

✔ Does NOT contain main() method
✔ Extends Applet class
✔ Uses paint() method
✔ Runs inside browser or applet viewer
✔ Used for graphics and GUI


Example of Java Applet Program

import java.applet.*; import java.awt.*; public class HelloApplet extends Applet { public void paint(Graphics g) { g.drawString("Hello ICSE Students!", 50, 50); } }

📌 This program displays text in a browser window.


Difference Between Applet and Application (Important for ICSE Exam)

Basis          Application Program        Applet Program       
Main Method   RequiredNot Required
ExecutionRuns independentlyRuns inside browser
PackageNo need to extend Applet    Must extend Applet
UsageGeneral programsGraphics & Web-based
ICSE FocusPractical + TheoryMostly Theory

Phases of Program Execution in Java 

In this article, we will explain all the phases of Java program execution in a simple and exam-oriented way.


What is Program Execution in Java?

Program execution means the process through which a Java program is written, compiled, and finally executed to produce output.


Phases of Program Execution in Java

There are mainly three important phases:

1️⃣ Writing the Java Program (Source Code)
2️⃣ Compilation
3️⃣ Execution

Let’s understand each phase in detail.


1️⃣ Writing the Java Program (Source Code Phase)

In this phase:

  • The programmer writes Java code.

  • The file is saved with .java extension.

  • The file name must match the class name.

Example:

If class name is:

class TestProgram

Then file name must be:

TestProgram.java

📌 Important ICSE Point: Java is case-sensitive.


2️⃣ Compilation Phase

After writing the program, the next step is compilation.

Compilation is done using:

javac filename.java

What happens during compilation?

  • Java compiler (javac) checks for syntax errors.

  • If errors are found → Compilation fails.

  • If no errors → Bytecode file is created.

The compiler creates a file with .class extension.

Example:

TestProgram.class

📌 Important ICSE Concept:
Java compiler converts source code into Bytecode, not machine code.


3️⃣ Execution Phase

After successful compilation, the program is executed using:

java filename

What happens during execution?

  • JVM (Java Virtual Machine) reads the bytecode.

  • JVM converts bytecode into machine code.

  • Output is displayed on screen.

📌 Important ICSE Concept:
JVM makes Java platform independent.


Diagram of Java Program Execution

Source Code (.java)
Compiler (javac)
Bytecode (.class)
JVM
Output

Why Java is Platform Independent?

Because:

  • Java converts code into bytecode.

  • Bytecode runs on JVM.

  • JVM is available for different operating systems.

That’s why Java follows:

👉 “Write Once, Run Anywhere


Example of Complete Execution Process

Step 1: Write Code

class Hello { public static void main(String args[]) { System.out.println("Hello ICSE Students"); } }

Step 2: Compile

javac Hello.java

Step 3: Run

java Hello

Output:

Hello ICSE Students

Common Errors in Program Execution 

✔ Syntax Error – Mistake in writing code
✔ Runtime Error – Error during execution
✔ Logical Error – Wrong output due to wrong logic


Difference Between Source Code and Bytecode 

Basis      Source Code                      Bytecode                             
Definition     Original program written by programmerCode generated after compilation
File Extension.java.class
ReadabilityHuman-readableNot human-readable
Created ByProgrammerJava Compiler (javac)
ExecutionCannot run directlyExecuted by JVM
PurposeWriting programRunning program

What is JVM (Java Virtual Machine)

JVM (Java Virtual Machine) is a virtual machine that runs Java bytecode. When you compile a Java program, it generates bytecode (.class file). This bytecode cannot run directly on your computer. It runs on the JVM.

Main Functions of JVM:

✔ Executes Java program
✔ Makes Java platform independent
✔ Manages memory
JVM is responsible for “Write Once, Run Anywhere”.

What is JRE (Java Runtime Environment)?

In Simple Words:
JRE = JVM + Libraries

What is JDK (Java Development Kit)?

JDK = JRE + Development Tools


Relationship Between JDK, JRE, and JVM

Contains JRE

JRE contains JVM
JRE = JVM + Libraries


Difference Between JDK, JRE, and JVM (ICSE Table Format)

Basis        JVM           JRE                    JDK                           

Full Form

Java Virtual Machine

Java Runtime Environment

Java Development Kit

Purpose

Executes bytecode

Runs Java programs

Develops & runs Java programs

Contains

Execution engine

JVM + Libraries

JRE + Compiler

Used For

Running program

Running program

Writing & compiling program

Required By

All Java users

End users

Programmers

Main Features of Java 

1️⃣ Simple


2️⃣ Object-Oriented
3️⃣ Platform Independent
4️⃣ Secure
5️⃣ Robust
6️⃣ Portable
7️⃣ Multithreaded
8️⃣ Distributed
9️⃣ Dynamic

Features of Java 

✔ Object-Oriented
✔ Platform Independent
✔ Secure
✔ Robust
✔ Portable
✔ Multithreaded
✔ Distributed
✔ Dynamic

Read More: OOP's Principal


Comments

Popular posts from this blog

Introduction to Object Oriented Programming and Java- ICSE Notes

Introduction to OOP's

Object Modelling – Entities and Their Behaviour in Java