๐ Welcome to Java!
Fun Fact ๐ก
Java was initially called Oak. It was renamed Java after the developers had coffee from Java Island! โ That's why Javaโs logo has a steaming cup of coffee.
๐ What is Java?โ
Java is a high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible. It was created by James Gosling at Sun Microsystems in 1995.
Java is widely used to build:
- Web applications
- Android apps
- Enterprise software
- Desktop tools
- Games
- Embedded systems
๐ค Definitionโ
Java is a platform-independent, object-oriented, secure, and robust programming language known for its โWrite Once, Run Anywhereโ philosophy.
๐ถ Explain Like Iโm Five (ELI5)โ
Imagine you wrote a letter to your friend.
Now instead of writing it in your friendโs language, you write it in a universal code everyone understands. Thatโs Java! It translates itself to a form any computer can understand, no matter what language that computer speaks.
๐ผ Real-World Examplesโ
- Android Apps: Instagram, Twitter, Spotify (Java powers many mobile apps)
- Enterprise Systems: Banking platforms like HDFC, SBI use Java for backend systems
- Web Apps: Java powers parts of Amazon and LinkedIn
- Embedded Devices: Java is used in smartcards, set-top boxes, and IoT
๐ฆ Features of Javaโ
| Feature | Description |
|---|---|
| Simple | Easy to learn and use |
| Object-Oriented | Everything is treated as an object |
| Platform Independent | Java code runs on any system with Java Virtual Machine (JVM) |
| Secure | Has built-in security features |
| Robust | Handles errors well, avoids system crashes |
| Multithreaded | Can perform multiple tasks simultaneously |
| High Performance | Uses Just-In-Time compilers to improve performance |
๐ป Sample Codeโ
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
๐ฏ Output:
Hello, World!
โถ๏ธ Try it yourselfโ
๐ง Interactive Flow: How Java Worksโ
Code (.java) โ Compiler (javac) โ Bytecode (.class) โ JVM โ Output
๐ The Java compiler converts .java files to .class files (bytecode), and the JVM executes this bytecode on any platform.
๐ Exerciseโ
- Who created Java and when?
- What does โWrite Once, Run Anywhereโ mean?
- Try writing your own HelloWorld.java using any online Java compiler.