Java Quick Revision Notes: Parts 1 & 2
Java Quick Revision Notes: Parts 1 & 2
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 .