Basic Java Interview Questions and Answers for Beginners, Schemes and Mind Maps of Computer science

A comprehensive set of basic java interview questions and answers, covering fundamental concepts such as jdk, jvm, jre, heap vs. Stack memory, jit compilers, object-oriented programming in java, differences between java and c++, pointers, instance and local variables, and data encapsulation. it's valuable for beginners learning java or preparing for job interviews. The questions are clearly explained with concise and informative answers, making it an excellent resource for self-study or guided learning.

Typology: Schemes and Mind Maps

2022/2023

Available from 04/25/2025

jayasri-prabakaran
jayasri-prabakaran 🇮🇳

4 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
BASIC INTERVIEW QUESTIONS IN JAVA
What is JDK?
JDK stands for Java development kit.
It can compile, document, and package Java programs.
It contains both JRE and development tools.
What is JVM?
JVM stands for Java virtual machine.
It is an abstract machine that provides a run-time environment that allows
programmers to execute Java bytecode.
JVM follows specification, implementation, and runtime instance notations.
What is JRE?
JRE stands for Java runtime environment.
JRE refers to a runtime environment that allows programmers to execute Java
bytecode.
JRE is a physical implementation of the JVM.
In Java, what are the differences between heap and stack memory?
Memory
Stack memory is used only by one thread of execution.
All the parts of the application use heap memory.
Access
&Other threads can’t access stack memory.
&Objects stored in the heap are globally accessible.
Memory Management
Stack follows the LIFO manner to free memory.
Memory management for heap stems from the generation associated with each object.
Lifetime
Stack exists until the end of the execution of the thread.
Heap memory lives from the start till the end of application execution.
pf3

Partial preview of the text

Download Basic Java Interview Questions and Answers for Beginners and more Schemes and Mind Maps Computer science in PDF only on Docsity!

BASIC INTERVIEW QUESTIONS IN JAVA

What is JDK?  JDK stands for Java development kit.  It can compile, document, and package Java programs.  It contains both JRE and development tools. What is JVM?  JVM stands for Java virtual machine.  It is an abstract machine that provides a run-time environment that allows programmers to execute Java bytecode.  JVM follows specification, implementation, and runtime instance notations. What is JRE?  JRE stands for Java runtime environment.  JRE refers to a runtime environment that allows programmers to execute Java bytecode.  JRE is a physical implementation of the JVM. In Java, what are the differences between heap and stack memory? Memory  Stack memory is used only by one thread of execution.  All the parts of the application use heap memory. Access  Other threads can’t access stack memory.  Objects stored in the heap are globally accessible. Memory Management  Stack follows the LIFO manner to free memory.  Memory management for heap stems from the generation associated with each object. Lifetime  Stack exists until the end of the execution of the thread.  Heap memory lives from the start till the end of application execution.

Usage  Stack memory only contains local primitive and reference variables to objects in heap space.  Whenever you create an object, it is always stored away in the heap space. What is a JIT compiler? A JIT compiler runs after the program is executed and compiles the code into a faster form, hosting the CPU’s native instructing set. How does a JIT compiler differ from a standard compiler? JIT can access dynamic runtime information, and a standard compiler does not. Therefore, JIT can better optimize frequently used inlining functions. Can java be said to be the complete object-oriented programming language? It is not wrong if we claim that Java is the complete object-oriented programming language because everything in Java is under the classes and we can access them by creating the objects. But we can even say that Java is not a completely object-oriented programming language because it has the support of primitive data types like int, float, char, boolean, double, etc. Now for the question: Is Java a completely object-oriented programming language? We can say that - Java is not a pure object-oriented programming language, because it has direct access to primitive data types. And these primitive data types don't directly belong to the Integer classes. How is Java different from C++?  C++ is only a compiled language, whereas Java is compiled as well as an interpreted language.  Java programs are machine-independent whereas a c++ program can run only in the machine in which it is compiled.  C++ allows users to use pointers in the program. Whereas java doesn’t allow it. Java internally uses pointers.  C++ supports the concept of Multiple inheritances whereas Java doesn't support this. And it is due to avoiding the complexity of name ambiguity that causes the diamond problem. Pointers are used in C/ C++. Why does Java not make use of pointers?  Pointers are quite complicated and unsafe to use by beginner programmers. Java focuses on code simplicity, and the usage of pointers can make it challenging. Pointer utilization can also cause potential errors. Moreover, security is also