Category: Java Interview Questions
-
What is a Marker Interface?
An empty interface in Java is referred to as a Marker interface. Serializable and Cloneable are some famous examples of Marker Interface.
-
Define Copy Constructor in Java
A Copy Constructor in Java is a constructor that initializes an object through another object of the same class.
-
What do you mean by aggregation?
The term aggregation refers to the relationship between two classes best described as a “whole/part” and “has-a” relationship. This kind is the most specialized version of an association relationship. It contains the reference to another class and is said to have ownership of that class.
-
What is an Association?
An Association can be defined as a relationship that has no ownership over another. For example, a person can be associated with multiple banks, and a bank can be related to various people, but no one can own the other. Get access and complete hands-on experience on a plethora of software development skills in our…
-
Explain the expected output of the following code segment?
The answers for the two print statements are as follows.
-
What is the default value stored in Local Variables?
Neither the Local Variables nor any primitives and Object references have any default value stored in them.
-
Will the program run if we write static public void main?
Yes, the program will successfully execute if written so. Because, in Java, there is no specific rule for the order of specifiers
-
What are the differences between Heap and Stack Memory in Java?
Stack memory in data structures is the amount of memory allocated to each individual programme. It is a fixed memory space. Heap memory, in contrast, is the portion that was not assigned to the Java code but will be available for use by the Java code when it is required, which is generally during the program’s…
-
What are the Memory Allocations available in JavaJava?
Java has five significant types of memory allocations.
-
What is a ClassLoader?
A classloader in Java is a subsystem of Java Virtual Machine, dedicated to loading class files when a program is executed; ClassLoader is the first to load the executable file. Java has Bootstrap, Extension, and Application classloaders.