DEV Community

Karthick Narayanan
Karthick Narayanan

Posted on

Day 1: Intro to Java Programming

Hello everyone
This is my Day 1 learning blog on Java programming. I am a beginner, and in this post, I will share what I learned in a simple and easy way.

1. What is Java?

  • Java is a programming language and one of the most popular and widely used languages.
  • Java is platform-independent, which means write once, run anywhere.
  • Java is an object-oriented programming language.
  • Java allows humans to write programs using English-like syntax, which computers can process.

2. How Do Humans and Machines Understand Code?

  • Humans understand languages like English
  • Machines understand only binary code (0's and 1's). For example: 10101010
  • So, Java acts as a bridge between humans and machines using multiple components (JDK, JVM, etc.).

Java Works in Levels

=> Level 1: JDK (Java Development Kit)

JDK (Java Development Kit)

  • It is used to write and develop Java programs
  • Java programs compiled using JDK are platform-independent, but JDK itself is platform-specific.

Example Java file:

Sample.java
Enter fullscreen mode Exit fullscreen mode

If there is a mistake in code, then we will encounter a syntax error.

To compile Java code:

javac Sample.java
Enter fullscreen mode Exit fullscreen mode

If compilation is successful, a new Sample.class will be generated in the location where your Sample.java file is located.

=> Level 2: JRE, JVM, and JIT

JRE (Java Runtime Environment)

  • JRE (Java Runtime Environment) provides the required environment to run Java programs.
  • It includes JVM and core Java libraries.
  • JRE is responsible for executing .class files safely on the system.

JVM (Java Virtual Machine)

  • JVM (Java Virtual Machine) executes Java bytecode.
  • Acts as a bridge between Java and the system
  • It converts bytecode into machine-specific instructions.
  • JVM makes Java platform-independent.

JIT (Just-In-Time Compiler)

  • JIT (Just-In-Time Compiler) converts bytecode into native machine code at runtime.
  • It improves performance by compiling frequently used code.
  • Conversion happens while the program is running.

Top comments (0)