100+ Java Interview Questions You Must Prepare in 2019: Mymock Interview Service For Real Tech Jobs
100+ Java Interview Questions You Must Prepare in 2019: Mymock Interview Service For Real Tech Jobs
100+ Java Interview Questions You Must Prepare in 2019: Mymock Interview Service For Real Tech Jobs
Categories
100+ Java Interview Questions You Must Prepare In
2019
Arti cial 685.3K Views
Intelligence
Visualization
Big
Data
myMock Interview Service for Real Tech Jobs
Blockchain
Cloud
Computing
Cyber
Security
Data
Science
Data
Warehousing
and
ETL
Databases Mock interview in latest tech domains i.e JAVA, AI, DEVOPS,etc
Get interviewed by leading tech experts
Front
End Java Interview Questions
Web In this Java Interview Questions blog, I am going to list some of the
Development
most important Java Interview Questions and Answers which
Architecture
Java Interview Questions and Answers | Jav…
Jav…
So let’s get started with the rst set of basic Java Interview
Questions.
It is an abstract
JRE refers to a
It is the tool machine. It is a
runtime
necessary to speci cation that
environment in
compile, document provides a run-time
which Java
and package Java environment in which
bytecode can be
programs. Java bytecode can be
executed.
executed.
ArrayList Vector
Q10. What are the di erences between Heap and Stack Memory
in Java?
The major di erence between Heap and Stack memory are:
Memory management is
Memory Follows LIFO manner based on the generation
Management to free memory. associated with each
object.
1. Default
2. Private
3. Protected
4. Public
Same Package
YES NO YES YES
subclass
Di erent package
NO NO YES YES
subclass
Di erent package
NO NO NO YES
non-subclass
1 class Abc {
2 member variables // class body
3 methods}
1. State
2. Behavior
3. Identity
Example
Whereas, an instance variable in Java, is a variable which is
bounded to its object itself. These variables are declared within
a class, but outside a method. Every object of that class will create
it’s own copy of the variable while using it. Thus, any changes made
to the variable won’t re ect in any other instances of that class and
will be bound to that particular instance only.
1 class Test{
2 public String EmpName;
3 public int empAge;
4 }
Methods Constructors
3. Needs to be invoked
3. Is invoked implicitly
explicitly
nal variable
When the nal keyword is used with a variable then its value
can’t be changed once assigned. In case the no value has been
assigned to the nal variable then using only the class
constructor a value can be assigned to it.
nal method
nal class
break continue
1. Can be used in switch and 1. Can be only used with loop
loop (for, while, do while) statements
statements
Example break:
Example continue:
For example:
this() super()
1. this() represents the current 1. super() represents the current
instance of a class instance of a parent/base class
2. Used to call the default
2. Used to call the default
constructor of the parent/base
constructor of the same class
class
3. Used to access methods of 3. Used to access methods of
the current class the base class
4. Used for pointing the current 4. Used for pointing the
class instance superclass instance
5. Must be the rst line of a
5. Must be the rst line of a block
block
Constant
Storage Area Heap Area Heap Area
String Pool
1. Bootstrap ClassLoader
2. Extension ClassLoader
3. System/Application ClassLoader
Array ArrayList
Q33. What is collection class in Java? List down its methods and
interfaces.
In Java, the collection is a framework that acts as an architecture for
storing and manipulating a group of objects. Using Collections you
can perform various tasks like searching, sorting, insertion,
manipulation, deletion, etc. Java collection framework includes the
following:
Interfaces
Classes
Methods
In case you are facing any challenges with these java interview
questions, please comment on your problems in the section below.
Powered by Edureka
BOOK A SLOT
1 class Car {
2 void run()
3 {
4 System.out.println(“car is running”
5 }
6 }
7 class Audi extends Car {
8 void run()
9 {
10 System.out.prinltn(“Audi is running safel
11 }
12 public static void main(String args[])
13 {
14 Car b= new Audi(); //upcasting
15 b.run();
16 }
17 }
1 class Adder {
2 Static int add(int a, int b)
3 {
4 return a+b;
5 }
6 Static double add( double a, double b)
7 {
8 return a+b;
9 }
10 public static void main(String args[])
11 {
12 System.out.println(Adder.add(11,11));
13 System.out.println(Adder.add(12.3,12.6));
14 }}
Method Overriding:
In Method Overriding, the subclass has the same method with
the same name and exactly the same number and type of
parameters and same return type as a superclass.
Method Overriding is to “Change” existing behavior of the
method.
It is a run time polymorphism.
The methods must have the same signature.
It always requires inheritance in Method Overriding.
1 class Car {
2 void run(){
3 System.out.println(“car is running”
4 }
5 Class Audi extends Car{
6 void run()
7 {
8 System.out.prinltn("Audi is running safely with
9 }
10 public static void main( String args[])
11 {
12 Car b=new Audi();
13 b.run();
14 }
15 }
1 class Base {
2 private static void display() {
3 System.out.println("Static or class method from
4 }
5 public void print() {
6 System.out.println("Non-static or instance meth
7 }
8 class Derived extends Base {
9 private static void display() {
10 System.out.println("Static or class method from
11 }
12 public void print() {
13 System.out.println("Non-static or instance meth
14 }
15 public class test {
16 public static void main(String args[])
17 {
18 Base obj= new Derived();
19 obj1.display();
20 obj1.print();
21 }
22 }
1 class Demo
2 {
3 int i;
4 public Demo(int a)
5 {
6 i=k;
7 }
8 public Demo(int a, int b)
9 {
10 //body
11 }
12 }
In case you are facing any challenges with these java interview
questions, please comment on your problems in the section below.
Apart from this Java Interview Questions Blog, if you want to get
trained from professionals on this technology, you can opt for a
structured training from edureka!
Get Post
Idempotent Non-Idempotent
1.void forward()
2.void include()