Java Indentent: Understanding Java Programs and JVM

𝗗𝗔𝗬 𝟭 – 𝗛𝗼𝘄 𝗝𝗮𝘃𝗮 𝗕𝗲𝗰𝗮𝗺𝗲 𝗣𝗹𝗮𝘁𝗳𝗼𝗿𝗺 𝗜𝗻𝗱𝗲𝗽𝗲𝗻𝗱𝗲𝗻𝘁 𝐋𝐞𝐭’𝐬 𝐬𝐭𝐚𝐫𝐭 𝐟𝐫𝐨𝐦 𝐳𝐞𝐫𝐨. 𝐁𝐞𝐟𝐨𝐫𝐞 𝐉𝐚𝐯𝐚... 𝐛𝐞𝐟𝐨𝐫𝐞 𝐜𝐨𝐝𝐞... 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗮 𝗽𝗿𝗼𝗴𝗿𝗮𝗺? A program is simply a set of instructions. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝘀𝗼𝗳𝘁𝘄𝗮𝗿𝗲? A collection of programs designed to solve a problem. 𝗡𝗼𝘄 𝗵𝗲𝗿𝗲’𝘀 𝘁𝗵𝗲 𝗿𝗲𝗮𝗹 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻: If we write instructions in English-like code… 𝐇𝐨𝐰 𝐝𝐨𝐞𝐬 𝐚 𝐦𝐚𝐜𝐡𝐢𝐧𝐞 𝐮𝐧𝐝𝐞𝐫𝐬𝐭𝐚𝐧𝐝 𝐢𝐭? Machines only understand 𝗯𝗶𝗻𝗮𝗿𝘆 - 𝟬𝘀 𝗮𝗻𝗱 𝟭𝘀. So somewhere, our human-readable code must be translated into machine-understandable instructions. Most languages use: → 𝗔 𝗰𝗼𝗺𝗽𝗶𝗹𝗲𝗿 or → 𝗔𝗻 𝗶𝗻𝘁𝗲𝗿𝗽𝗿𝗲𝘁𝗲𝗿 𝗝𝗮𝘃𝗮 𝘂𝘀𝗲𝘀 𝗯𝗼𝘁𝗵. And that’s where the story gets interesting. 𝗪𝗵𝗲𝗻 𝘄𝗲 𝘄𝗿𝗶𝘁𝗲 𝗮 𝗝𝗮𝘃𝗮 𝗽𝗿𝗼𝗴𝗿𝗮𝗺: 𝗦𝘁𝗲𝗽 𝟭: The javac compiler (from JDK) converts our .java file into a .class file. This .class file contains 𝗯𝘆𝘁𝗲𝗰𝗼𝗱𝗲. 𝘽𝙮𝙩𝙚𝙘𝙤𝙙𝙚 𝙞𝙨 𝙣𝙤𝙩 𝙝𝙪𝙢𝙖𝙣 𝙡𝙖𝙣𝙜𝙪𝙖𝙜𝙚. 𝙄𝙩’𝙨 𝙣𝙤𝙩 𝙧𝙖𝙬 𝙢𝙖𝙘𝙝𝙞𝙣𝙚 𝙘𝙤𝙙𝙚 𝙚𝙞𝙩𝙝𝙚𝙧. 𝙄𝙩’𝙨 𝙖𝙣 𝙞𝙣𝙩𝙚𝙧𝙢𝙚𝙙𝙞𝙖𝙩𝙚 𝙡𝙖𝙣𝙜𝙪𝙖𝙜𝙚 𝙙𝙚𝙨𝙞𝙜𝙣𝙚𝙙 𝙨𝙥𝙚𝙘𝙞𝙛𝙞𝙘𝙖𝙡𝙡𝙮 𝙛𝙤𝙧 𝙨𝙤𝙢𝙚𝙩𝙝𝙞𝙣𝙜 𝙘𝙖𝙡𝙡𝙚𝙙 𝙩𝙝𝙚 𝙅𝙑𝙈. Now enters the hero: 𝗝𝗩𝗠 (Java Virtual Machine) The JVM reads the bytecode and converts it into machine-level instructions for the specific operating system it is running on. 𝗛𝗲𝗿𝗲’𝘀 𝘁𝗵𝗲 𝗽𝗼𝘄𝗲𝗿𝗳𝘂𝗹 𝗽𝗮𝗿𝘁: The same .class file can run on Windows, Linux, or Mac - as long as that system has 𝗶𝘁𝘀 𝗼𝘄𝗻 𝗝𝗩𝗠. That’s why Java is called: 𝗣𝗹𝗮𝘁𝗳𝗼𝗿𝗺 𝗜𝗻𝗱𝗲𝗽𝗲𝗻𝗱𝗲𝗻𝘁 (Write Once, Run Anywhere) Security, huge libraries, built-in APIs, memory management - all of that matters. 𝗕𝘂𝘁 𝘁𝗵𝗶𝘀 𝗮𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲? This is what made Java revolutionary. 𝗧𝗼𝗺𝗼𝗿𝗿𝗼𝘄 (𝗗𝗮𝘆 𝟮): We’ll break down: • What exactly is JDK, JRE, JVM? • How they relate to each other • And what actually happens when you run 𝙹𝙰𝚅𝙰 𝙷𝙴𝙻𝙻𝙾𝚆𝙾𝚁𝙻𝙳 𝙏𝙝𝙞𝙨 𝙞𝙨 𝙟𝙪𝙨𝙩 𝙩𝙝𝙚 𝙗𝙚𝙜𝙞𝙣𝙣𝙞𝙣𝙜. Notes credit goes to my mentor Banti Chouhan sir 🥹🙏🏻 #Java #Backend #Programming #LearnInPublic #Day1

  • diagram

To view or add a comment, sign in

Explore content categories