Skip to content

hadijahkyampeire/FPP-Group-5

Repository files navigation

Lesson-1-Interview Reading Questions

  1. Explain the execution flow of a Java Program.
  • Java sorce --> .java(Platform dependent)
  • Compiled by the Java compiler(javac) --> bytecode.class (Platform independent)
  • JVM which has JI or JIT --> Security checks and interprets bytecode to machine language code (Platform dependent)
  • OS --> Runs the machine code
  1. What are source code and byte code files in Java?

Source Code (.java files):

Definition: Human-readable code written by developers using the Java programming language. Purpose: Defines the logic, structure, and behavior of Java applications.

Bytecode (.class files):

Definition: Platform-independent code generated by the Java compiler from source code. Purpose: Executed by the JVM, allowing Java programs to run on any device with a compatible JVM.

  1. Why is Java termed as a platform-neutral or independent language?
  • "Write Once, Run Anywhere": Java programs are compiled into bytecode, which can run on any device equipped with a JVM.
  1. What is the role of JRE?
  • Java Runtime Environment (JRE):

Purpose: Provides the necessary libraries, Java Virtual Machine (JVM), and other components to run Java applications.

  • Components: JVM: Executes Java bytecode. Libraries: Pre-built classes and packages that Java programs use. Other Files: Configuration and supporting files required for runtime.

Key Point: The JRE does not include development tools like the compiler (javac); it's solely for running Java applications.

  1. What are the components of JRE and its functionalities?
  • Components of JRE:

  • Java Virtual Machine (JVM): Executes Java bytecode. Manages memory through garbage collection.

  • Core Libraries: Provides essential classes and APIs (e.g., java.lang, java.util).

  • Java Class Loader: Loads classes into the JVM as needed.

  • Java Runtime Libraries: Include libraries for input/output, networking, security, and more.

Functionalities:

  • Execution Environment: Runs Java applications by interpreting or compiling bytecode.
  • Memory Management: Automatically handles memory allocation and garbage collection.
  • Security: Enforces security policies to protect against malicious code.
  • Standard Libraries Support: Provides a vast set of reusable code to perform common tasks.
  1. What is the importance of JIT?
  • Just-In-Time (JIT) Compiler:

Purpose: Enhances the performance of Java applications by compiling bytecode into native machine code at runtime. Functionality: Dynamic Compilation: Converts frequently executed bytecode into optimized machine code on the fly. Performance Boost: Reduces the execution time of Java programs by allowing the CPU to run native code directly. Adaptive Optimization: Analyzes the running program and optimizes code paths that are used often. Importance:

Speed: Significantly improves the execution speed of Java applications. Efficiency: Makes Java competitive with natively compiled languages by optimizing runtime performance. Resource Management: Balances compilation time with runtime performance to optimize overall application efficiency.

  1. What is the difference between JVM, JRE, and JDK?
  • Java Virtual Machine (JVM):

What It Is: A component that executes Java bytecode. Function: Runs Java applications by interpreting or compiling bytecode into machine code. Scope: Part of both JRE and JDK.

  • Java Runtime Environment (JRE):

What It Is: A package that includes the JVM and essential libraries needed to run Java applications. Function: Provides the environment required to execute Java programs. Includes: JVM, core libraries, and supporting files. Does Not Include: Development tools like compilers or debuggers.

  • Java Development Kit (JDK):

What It Is: A full-featured kit for Java developers. Function: Provides tools needed to develop, compile, debug, and run Java applications. Includes: JRE (which contains JVM), compilers (javac), debuggers, and other development tools. Summary:

JVM: Runs Java bytecode. JRE: Contains JVM and libraries to run Java applications. JDK: Contains JRE plus development tools to create Java applications.

About

FPP Homework assignments for Group 5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages