CAF 6105-
ADVANCED JAVA
PROGRAMMING
DR. JOSE REENA K
MODULE 1
Introduction - Java features – Java Platform – Java
Fundamentals – Expressions, Operators, and Control
Structures.
The Java Class-Constructor, Inheritance, Derived
Classes, Method Overriding, Method Overloading,
Abstract Class and Method, Interfaces, Packages.
HISTORY OF JAVA
[Link]
• Java was originally developed by James Gosling and his team (called the "Green
Team") at Sun Microsystems in 1991.
• Initially, the project was named “Oak”, after an oak tree outside Gosling’s office.
• Later, it was renamed Java (inspired by Java coffee).
2. Purpose
• The original goal was to develop software for consumer electronic devices (like
TVs, VCRs, etc.).
• It was designed to be platform-independent and could run on different hardware.
FEATURES OF JAVA
• Simple – Easy to learn, especially for those familiar with C/C++.
• Object-Oriented – Uses objects and classes to structure programs.
• Platform Independent – Runs on any system that has a JVM.
• Robust – Strong memory management, exception handling, type-checking.
• Secure – Provides built-in security features.
• Multithreaded – Supports multiple tasks running simultaneously.
• Portable – Same code runs everywhere without changes.
• Distributed – Supports networking and distributed applications.
JAVA PLATFORM
What is a Platform?
• A platform is the environment in which a program runs
• Examples: Windows, Linux, macOS
• Java is a software-based platform that runs on top of OS
• Provides libraries + JVM for execution
Java Platform Components
[Link] Runtime Environment (JRE)
• Provides JVM + libraries
• Runs Java applications
[Link] Development Kit (JDK)
• Superset of JRE
• Includes compiler (javac), debugger, tools
3. Java Virtual Machine (JVM)
• Core of Java Platform
• Converts bytecode into machine code
• Provides platform independence
• Handles garbage collection & memory
BASIC STRUCTURE OF A JAVA PROGRAM
•Documentation Section (Comments)
•Package Declaration (Optional)
•Import Statements (Optional)
•Class Declaration
•Main Method
DOCUMENTATION & PACKAGE DECLARATION
// Documentation Section
// Program to display Hello World
package myPackage; // Optional
IMPORT & CLASS DECLARATION
import [Link].*; // Import (Optional)
class HelloWorld { // Class Declaration
MAIN METHOD & STATEMENTS
public static void Entry point of program–
main(String[] args)
public → accessible everywhere
{ static → runs without object
creation
[Link]("Hello, void → no return value
World!"); String[] args → accepts input
from command line
} // End of main
COMPLETE JAVA PROGRAM
// Documentation Section
// Program to display Hello World
package myPackage;
import [Link].*;
class HelloWorld {
public static void main(String[] args)
{ [Link]("Hello, World!");
}
}
public class EvenOdd {
public static void main(String[] args) {
int num = 10; // fixed number
if (num % 2 == 0) {
[Link](num + " is Even");
} else {
[Link](num + " is Odd");
}
public class LargestOfTwo {
public static void main(String[] args) {
int a = 25, b = 40; // fixed numbers
if (a > b)
[Link](a + " is larger.");
else
[Link](b + " is larger.");
}
}