Introduction to Java
Java is a general-purpose, object-oriented programming language used to develop desktop, web, mobile applications and more.
What is Java?
Java is a high-level programming language and platform developed by Sun Microsystems in 1995. It was created by James Gosling, known as the father of Java.
Key Characteristics:
- Object-Oriented - Built on classes and objects
- Platform Independent - Write once, run anywhere (WORA)
- Secure - Strong security features
- Robust - Strong error handling
- Runs on billions of devices worldwide
Fun Fact: Java was originally called "Oak" but was renamed to Java due to trademark issues.
Where is Java Used?
- Desktop Applications - Media players, text editors
- Web Applications - E-commerce sites, social media platforms
- Mobile Apps - Android applications
- Enterprise Systems - Banking, ERP systems
- IoT & Embedded Systems - Smart devices, robots
- Gaming - Game development and interactive apps
Your First Java Program
Let's write a simple Java program to print "Hello World":
Example: Hello World Program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Hello World
Explanation:
public class HelloWorld- Defines a class named HelloWorldpublic static void main(String[] args)- Entry point of the programSystem.out.println()- Prints text to the console
Types of Java Applications
1. Standalone Applications
Desktop programs that run on user's computer. Built with Swing, AWT, or JavaFX.
Examples: Notepad, VLC Player, Antivirus Software
2. Web Applications
Server-side applications that work with web browsers. Built with Servlets, JSP, or Spring Framework.
Examples: Amazon, LinkedIn, eBay
3. Mobile Applications
Apps developed for mobile devices. Primarily Android apps use Java/Kotlin.
Examples: WhatsApp, Instagram, Uber
4. Enterprise Applications
Large-scale systems for organizations. Built with Java EE, Hibernate, and messaging services.
Examples: Banking Systems, ERP Software, CRM Systems