Lesson 1. Overview of Java - Features and Execution Process | Learn Java Basics

Published on
Belongs to Category: Learn Basic Java|Posted by: Le Thanh Giang||7 min read
Facebook share iconLinkedIn share iconTwitter share iconPinterest share iconTumblr share icon
Lesson 1. Overview of the Java Programming Language | Learn Java Basics

What is Java Programming Language?

Java is a popular object-oriented programming language, developed by Sun Microsystems (now owned by Oracle) in 1995. Java stands out for its platform independence, meaning it can run on various operating systems thanks to the Java Virtual Machine (JVM). With the philosophy of "Write Once, Run Anywhere", Java has become one of the most widely used programming languages in areas such as web development, mobile applications, embedded systems, and artificial intelligence.

The Java Platform

Java is not just a programming language; it is also a software platform comprising several important components:

  • JDK (Java Development Kit): A toolkit for Java developers. It includes JRE, as well as javac (the compiler), other development tools, and libraries required for coding, compiling, and debugging Java applications.
  • JRE (Java Runtime Environment): The environment for running Java applications, containing the Java Virtual Machine (JVM) and libraries necessary to execute compiled Java programs. JRE does not include a compiler and development tools as it is only used to run already compiled Java applications.
  • Java Virtual Machine (JVM): The Java virtual machine ensures that Java code can run on any operating system that has a JVM installed.

To develop Java applications, you only need to install the JDK, as it already includes all necessary tools like the Java compiler, Java libraries, and the JRE to run Java applications.

An important feature of Java is its ability to reuse code through libraries and classes, helping developers save time in development as well as making maintenance and expansion of applications easier.

The Execution Process of a Java Program

Java Program Execution Process

Step 1: Write the Java Source Code

  • Java source code is written in files with the .java extension (e.g., App.java).
  • Developers use IDEs (such as IntelliJ IDEA, Eclipse, NetBeans) or text editors (such as VS Code, Notepad++) to write the code.

Step 2: Compile the Source Code

  • The Java compiler (javac) converts the source code from .java to bytecode stored in a .class file (e.g., App.class).
  • The compilation process helps to check syntax and basic logic errors before the program is executed.

Step 3: Execute the Bytecode on the Java Virtual Machine (JVM)

  • The Java Virtual Machine (JVM) loads and converts the bytecode into machine code suitable for the operating system.
  • Thanks to JVM, Java programs can run on Windows, Linux, macOS, or any system that has JVM installed.

Step 4: Run the Java Application

  • After the JVM interprets and executes the bytecode, the Java program runs and generates the desired result, such as displaying a user interface or processing data.

→ Platform independence: As long as there is a JVM, the Java program can run on any operating system without needing to recompile.

Comparison Between Java and C in Program Execution Process

FeatureJavaC
Compiled CodeBytecode (.class)Machine code (.exe or similar)
Execution EngineJava Virtual Machine (JVM)Operating system and CPU
Platform IndependenceYes (runs on any OS with JVM)No (needs separate compilation for each platform)
PerformanceLower, due to JVM needing to interpret bytecodeFaster, since it runs directly on the CPU
PortabilityHigh (Write Once, Run Anywhere)Low (depends on specific platform)

Key Differences in the Execution Process Between C and Java

  • C: A C program, after being compiled, generates machine code specific to the operating system and CPU (Windows requires .exe, Linux needs a different executable). Therefore, a C file cannot run on multiple platforms unless recompiled.
  • Java: A Java program is compiled into bytecode, which runs on the JVM of the respective operating system. This makes Java much more portable compared to C.

Applications of Java in Real Life

Java is a versatile programming language with various applications across different industries. Some key areas where Java is widely used include:

  1. Web Development: Java is commonly used to build dynamic and interactive websites. With the help of frameworks like Spring, Hibernate, and JavaServer Pages (JSP), developers can create powerful, scalable, secure, and maintainable web applications.

  2. Mobile Applications: Java is the primary language for developing Android applications. Using the Android SDK, developers can build feature-rich mobile applications that run on various devices, making Java an important language in mobile app development.

  3. Enterprise Software: Java is frequently used for developing large-scale enterprise applications. Its platform independence and security features make it an ideal choice for building complex systems like Customer Relationship Management (CRM), Enterprise Resource Planning (ERP), and banking systems.

  4. Big Data and Analytics: Java is also used in the field of Big Data. With frameworks like Apache Hadoop and Apache Spark, Java can efficiently handle large datasets, making it suitable for big data processing and analytics.

Java Fullstack Learning Path

The Java Full Stack learning path involves learning both Front-end (client-side) and Back-end (server-side) development, with Java as the core language. Here is a detailed roadmap:

  1. Java Basics: First, you need to master the basic concepts of Java programming, including syntax, variables, data types, control structures, loops, and object-oriented programming (OOP) principles such as classes, objects, inheritance, polymorphism, and encapsulation.

  2. Java Core Programming: Learn about essential Java APIs such as Collections, Exception Handling, IO (input/output), and Streams. These skills are crucial for building effective back-end applications.

  3. Web Development with Java (Back-end): Learn about web development with Java, including frameworks like Spring (Spring Boot, Spring MVC) to build powerful web applications, and Hibernate for database integration via ORM. You should also learn about RESTful APIs to create web services that the Front-end can interact with.

  4. Databases: Get familiar with databases such as MySQL, PostgreSQL, or NoSQL databases like MongoDB. Learn how to use JDBC (Java Database Connectivity) and integrate databases into Java applications.

  5. Front-end (Web Development): Although Java is primarily used for back-end development, as a Full Stack Developer, you need to have knowledge of front-end technologies. Learn web technologies such as HTML, CSS, and JavaScript, along with popular frameworks like React or Angular to build user interfaces.

  6. Version Control (Git): Learn how to use Git for source code management, along with services like GitHub or GitLab for storing and sharing code.

  7. DevOps and CI/CD: Have a basic understanding of the DevOps process, Continuous Integration (CI), and Continuous Deployment (CD) to help you deploy applications efficiently.

  8. Other Tools and Techniques: Familiarize yourself with tools that support development, such as Maven or Gradle for project management, JUnit for unit testing, and Docker for containerizing applications.

By mastering all the above skills, you will be able to become a Java Full Stack Developer, capable of developing both the front-end and back-end of web applications and deploying them professionally.

Conclusion

Java is a powerful programming language, popular for its platform independence, high security, and support for object-oriented programming. Although its performance may be slower compared to languages like C due to the need for interpretation through the JVM, its advantages in portability, code reuse, and a strong support community have made Java a top choice in many fields.

Java remains one of the most important programming languages in the modern tech world, from mobile apps (Android), web systems, enterprise applications to artificial intelligence.

Next lesson: Lesson 2. Guide to Install JDK and Eclipse

Latest Posts

Related Posts

Newsletter border

Subscribe to Receive Updates from RiverLee