0% found this document useful (0 votes)
19 views2 pages

Java Quick Revision Notes: Parts 1 & 2

Java is a high-level, object-oriented programming language known for its platform independence, developed by James Gosling in 1995. Key rules include case sensitivity, the necessity of a main method, and a single public class per file. Java has evolved through various versions, with significant updates in Java 8, 11, 17, and 21, and is widely used in enterprise applications and cloud computing.

Uploaded by

sahil dhawale
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Java Quick Revision Notes: Parts 1 & 2

Java is a high-level, object-oriented programming language known for its platform independence, developed by James Gosling in 1995. Key rules include case sensitivity, the necessity of a main method, and a single public class per file. Java has evolved through various versions, with significant updates in Java 8, 11, 17, and 21, and is widely used in enterprise applications and cloud computing.

Uploaded by

sahil dhawale
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Quick Revision Notes - Part 1 & 2

■ 1. What is Java?

■ Concept
- Java is a high-level, class-based, object-oriented programming language.
- Developed by James Gosling at Sun Microsystems in 1995.
- Known for platform independence → "Write Once, Run Anywhere (WORA)".
- Runs using JVM (Java Virtual Machine) which executes bytecode.

■ Important Rules / Exceptions


1. Java is case-sensitive (main ≠ Main).
2. The file name must match the public class name.
3. Only one public class allowed per .java file.
4. main method signature must be:
public static void main(String[] args)
- args can have any name, but String[] type is mandatory.
5. Without main, Java program won’t run (except JShell or static block before Java 7).

■ Interview Questions
- Why is Java called platform independent?
- Difference between JDK, JRE, JVM?
- Can we run a Java program without main() method?
- Why is main() method public static void?
- Is Java 100% Object-Oriented?

■■ Example
class HelloJava {
public static void main(String[] args) {
[Link]("Hello Java!");
}
}

■ Tips to Remember
- Java = OOP + Platform Independent + Secure + Robust.
- Keywords like goto & const are reserved in Java but not used.
- Always think of Java as a language + platform (JVM).
■ 2. History of Java

■ Concept
- 1991 → Project started by James Gosling & team at Sun Microsystems (called Oak).
- 1995 → Officially released as Java (since Oak was trademarked).
- Designed for embedded systems, interactive TV, later adapted for internet applications.
- 1996 → First JDK (Java Development Kit 1.0).
- 2009 → Oracle acquired Sun Microsystems → Java under Oracle.
- Today → widely used in Enterprise, Android, Microservices, Big Data, Cloud.

■ Important Rules / Exceptions


- Java versioning follows major releases (Java SE 8, 11, 17, 21 are LTS).
- Backward compatibility → Old Java code usually works in newer versions.
- Applets & Java Web Start deprecated & removed in Java 11+.

■ Interview Questions
- Who is the father of Java?
- Why was Java initially named Oak?
- What was Java’s original purpose?
- Which company owns Java now?
- Which Java versions are LTS?

■■ Example (Timeline)
1995 → Java 1.0
2004 → Java 5 (Generics, Annotations)
2011 → Java 7 (try-with-resources, switch on String)
2014 → Java 8 (Lambdas, Streams, Default Methods)
2017 → Java 9 (Modules)
2018 → Java 11 (LTS, Removed Applets, JavaFX out)
2021 → Java 17 (LTS, Sealed classes, Pattern Matching)
2023 → Java 21 (LTS, Virtual Threads)

■ Tips to Remember
- Java’s slogan: "Write Once, Run Anywhere."
- Always know Java 8, 11, 17, 21 → most used in industry.
- Interviewers often ask what changed in latest LTS version.

Common questions

Powered by AI

The JDK (Java Development Kit) includes the tools required for developing Java applications, such as the compiler. The JRE (Java Runtime Environment) provides the libraries and JVM needed to run Java applications. The JVM (Java Virtual Machine) is responsible for executing the bytecode generated by the compiler but cannot compile Java sources itself .

Java is not 100% object-oriented because it uses primitive data types (like int, char, etc.) that are not objects. Unlike pure object-oriented languages where everything is an object, Java maintains these primitives for simplicity and performance optimization. This allows for easier manipulation of basic numerical values without the overhead of object creation .

Java is considered platform independent due to its ability to run on any device with a JVM. The JVM allows Java programs to be run on any system without needing modification, as the Java compiler converts Java code into bytecode, which the JVM interprets. This eliminates the need for recompilation for different platforms .

Oracle's acquisition of Sun Microsystems in 2009 continued Java's robust development. Oracle has focused on regular updates and extensive backward compatibility, ensuring widespread adoption in enterprise environments. The frequent release of major versions and LTS versions like Java 11 and 17 helped stabilize the ecosystem, although some decisions, like the deprecation of Applets, shifted Java's focus mainly to server and enterprise applications .

The removal of Applets and Java Web Start in Java 11 marked a shift away from browser-based applications towards more secure and robust server-side and standalone applications. Applets, which provided dynamic, interactive features within browsers, were less commonly used due to security concerns and the rise of alternative technologies like HTML5 and JavaScript. This change has streamlined Java's focus on areas where it has significant strength, such as enterprise and large-scale application development .

The 'public static void main(String[] args)' method signature is the entry point of any standalone Java application. 'Public' makes it accessible to the JVM from anywhere, 'static' allows it to be called without creating an instance of the class, 'void' indicates it doesn't return a value, and '(String[] args)' accepts parameters from the command line . Without this method, the JVM would not know where to start executing the program .

Backward compatibility in Java ensures that applications written in older Java versions can run on newer versions without modification. This stability is vital for enterprise environments where updating systems to new software versions can be costly and time-consuming. It also encourages new version adoption while leveraging existing code bases, minimizing risk and maximizing resource efficiency .

Java has significantly evolved since its inception in 1995. Initially designed for interactive TV, it found widespread adoption in internet applications due to its platform independence. Key technological domains like Enterprise solutions, Android, Big Data, and Cloud computing have embraced it. Major language improvements include features like Generics in Java 5, Lambdas and Streams in Java 8, and the introduction of modules in Java 9. Support for modern programming methodologies has kept Java relevant, with recent LTS (Long Term Support) versions like Java 11, 17, and 21 streamlining enterprise use .

Java's 'Write Once, Run Anywhere' capability allows developers to execute compiled Java programs on any device with a JVM, without modifying the code for different platforms. This feature significantly reduces development and maintenance costs, as applications only need to be written once and can then be deployed on various systems. Such flexibility has made Java a preferred choice in industries ranging from mobile application development to enterprise-scale business solutions .

The name 'Oak' was chosen initially by Java's creator, James Gosling, because of an oak tree that stood outside his office. However, the name was changed to Java in 1995 since 'Oak' was already trademarked. The new name, Java, was selected for its reference to coffee, symbolizing energy and vitality, which aligned with Java's design to be simple and efficient .

You might also like