Java & JVM: From Script to Screen

·

2 min read

JAVA Fundamentals

Java is a programming language first released by Sun Microsystems in 1995.

  • Java is General Purpose, class-based & Object orientated programming language.

  • It is fast, reliable, and secure.

  • It is used for Mobile Applications, Web Applications, Games, Database integrations, and many more.

  • It works on multiple Operating systems.

  • It is Open source and powerful.

Java Virtual Machine (JVM)

The Java Virtual Machine (JVM) is a key part of the Java language. It's like a particular player that lets Java programs run on any computer or phone, regardless of its kind. This is why we say Java can work everywhere. We can say that JVM provides a runtime environment to execute Java code.

Understanding Java & JVM using Real life examples

Let's understand Java and JVM using real-life use cases of Short film and DVD players.

Short film (Java Source code) - Imagine you have made a film of your life story. This short film is like your Java code; it details your story with your flavors. If you want someone to watch the short film, you must format the story so their device can play.

DVD (Java Bytecode) - You burn the film onto a DVD format containing your version of the movie that can be played on various devices. This DVD is like the JAVA bytecode generated after the Java source code compilation. This is not the original script (source code) but a version the machine can relate to and execute.

DVD Player (JVM) - You need a device to read the DVD and play the movie on a screen to watch your film. You can watch your DVD if you have a DVD player from anywhere worldwide. Likewise, the JVM is similar to the DVD player. Any device can run the Java bytecode if it has JVM. The JVM reads and executes the Java bytecode (similar to DVD player reading and playing the movie on DVD). Hence, Java bytecode can be executed on different devices, making Java a versatile language.

In Abstract:

Java Source code = Original Short flim Script

Java Bytecode = DVD with the short flim

JVM = DVD player that can play the movie from the DVD

Thats it from my end and Stay tuned for more insightful content. Keep your spirits high and happy learning!