Basic Java Programs Asked in Interview with Answers Pdf - 1
Question: 1
What is heap and stack?
The heap is the part of memory of JVM where all objects reside.
The stack is consisted of stack frames. When a thread invokes a method, the JVM pushes a new frame onto that thread’s Java stack.
Each stack frame is consisted of operand stack and the local variable array.
All arguments local variables, intermediate computations and return values if any are kept in the stack corresponding to the method.
The stack frame on the top of the stack is called the active stack frame, which is current place of execution.
When the method completes, the virtual machine pops and discards the frame for that method.
Question: 2
What is a java package and how is it used?
A Java package is a naming context for classes and interfaces.
A package is used to create a separate name space for groups of classes and interfaces.
Packages are also used to organize related classes and interfaces into a single.
API unit and to control accessibility to these classes and interfaces.
Question: 3
What are the types of data types in java?
- byte
- short
- int
- float
- long
- double
- char and
- boolean
Question: 4
What is an object?
Object is an instance of a class and it is a software unit that combines a structured set of data with a set of operations for inspecting and manipulating that data.
When an object is created using new operator, memory is allocated to it.
Question: 5
What are object and class classes used for?
The Objects class is the highest level class in the Java class hierarchy.
The Java Class class is used to represent the classes and interfaces that are located by a Java program.
- Java Interview Questions and Answers
- Top 1000+ Java Interview Questions and Answers Pdf
- Top 500+ Advanced Java Interview Questions 2020-2021
- Java Interview Questions and Answers for Freshers Pdf
- Java Interview Questions and Answers for Experienced Pdf
- Java Programming Basics Interview Questions
- Java OOPS Interview Questions for 3 years experienced
- Basic Java Programs Asked in Interview with Answers Pdf
- Java Programming Interview Questions and Answers
- C | C++ | Java Interview Questions and Answers
- JavaScript Interview Questions Pdf
- Javascript Coding Interview Questions Pdf
GK Questions and Answers on Computer 2026-2027 More
Computer Awareness IBPS PO 2026-2027 Pdf More
Computer Capsule 2026-2027 Pdf More
Database Administrator MCQS with Answers Pdf More
Database Concepts MCQ Questions and Answers Pdf More
Climate, Forest, Soil and Natural Vegetation TNPSC MCQ Questions More
TNPSC The Age of Revolutions Questions and Answers More
TNPSC Group 4 Question Bank with Answers Free Download More
History General Awareness Gk Questions and Answers More
Gate Mechanical Engineering Questions and Answers Pdf More