0% found this document useful (0 votes)
2 views14 pages

java_mayank_impQ

The document contains a comprehensive list of important Java interview questions covering various topics such as Object-Oriented Programming (OOP), exception handling, multithreading, and the collection framework. Each section includes fundamental concepts, definitions, and differences between related terms, aimed at helping candidates prepare for technical interviews. The questions range from basic definitions to advanced topics, ensuring a thorough understanding of Java programming.

Uploaded by

soumyasingh43636
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views14 pages

java_mayank_impQ

The document contains a comprehensive list of important Java interview questions covering various topics such as Object-Oriented Programming (OOP), exception handling, multithreading, and the collection framework. Each section includes fundamental concepts, definitions, and differences between related terms, aimed at helping candidates prepare for technical interviews. The questions range from basic definitions to advanced topics, ensuring a thorough understanding of Java programming.

Uploaded by

soumyasingh43636
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JAVA MOST IMPORTANT QUESTION

OOPS
1) What is class?
2) What is object or instance of class?
3) What is Member variables, how it is different from
local variables
4) What is static variables? explain
5) What is non-static variables or instance variables?
explain
6) How to access static members? Explain
7) How to access non-static members of class? Explain
8) How to create an instance of class? Explain
9) What are the difference between static and non-static
members of class
10) Give example when to use static variables and non-
static variables
11) What is reference variables? How to create it?
12) What is primitive variables in java? how to declare
it?
13) What is non-primitive variables in Java? how to
declare it?
14) Explain how many ways member variables can be
initialized?
15) explain static blocks and non-static blocks
16) What is constructors? why it is required?
17) Does every class has constructor?
18) What is default constructor?
19) What is parameterized constructor?
20) What is user defined constructor?
21) What is constructor Overloading?explain its benefit
22) Explain this keyword, what it contains and how it is
useful
23) Explain this() statement, explain why it is required?
24) Does constructor has return type?
25) What does new operator used for and what it returns
26) Does java supports pass by reference? why
27) Does constructor be static?
28) Does constructor be inherited?
29) Can we delcare constructor as private?
30) What is the access of default constructor?
31) Can we override Constructor of class?
32) What is constructor calling or constructor chaining?
33) Explain super() statement, explain why it is required?
34) what is the difference between this() and super()
35) Explain super keyword, what is the use of it?
36) What is the difference between super and this
keyword
37) Explaing final member variables and how to
initialize?
38) Give example when to use final instance variable?
39) Explaing Has-A relationship? how to achive it?
40) Explain what you mean by static reference variable?
41) Explain what you mean by instance reference
variable?
42) What is inheritance? explain its advantages
43) What are the types of inheritance? Explain
44) Why does java doesn't support multiple inheritance?
45) What is super class or base class?
46) What is sub class or derived class?
47) Which members of super class can be inherited to sub
class
48) Can we inherit Constructor of super class?
49) What is the role of Constructor in inhertiance?
50) From which super class the sub class cann't inherit?
51) If super class has private constructor, can sub class
inherit its members?
52) What is implicit constructor call and explicit
constructor call?
53) When to go for explicit constructor call?
54) What is method overloading? Explain
55) When to go for Method overloading? give real time
examples
56) Can sub class overload the methods of super class?
57) Can we overload main method?
58) What is benefit of method overloading?
59) What is method overriding? Explain,give real time
examples
60) What is the benefit of method overriding?
61) Which methods of super class can be overrided and
which can't be overrided?
62) What do you mean by declaring instance method as
final?
63) What is datatype casting? Explain its types
64) What is classtype casting? Explain its types
65) What is the pre-requiste to do class casting?
66) What is widening operation?
67) What is narrowing operation?
68) What is upcasting?
69) What is downcasting?
70) What is ClassCastException?When it occurs?
71) What is the reason for ClassCastException?
72) What is the use of instanceof operator in java?
73) When to perform downcasting?
74) Why we need class type casting?
75) What is polymorphism? Explain its types
76) What is runtime polymorphism? how to achieve it?
77) What is the uses of ploymorphism?
78) How to access general properties and how to access
specialized properties?
79) what is abstract method?
80) What is abstract class?explain its members
81) Can we create instance of abstract class
82) What the subclass should do if it extends from
abstract class
83) Can we define constructor in abstract class?
84) How to access the instance members of abstract
class?
85) Does abstract class must have abstract method?
86) Is abstract class pure abstract body?
87) What is interface? explain its characteristics?
88) Can we create instance of interface?
89) What is implementation class?
90) What must a class should do if it implements an
interface?
91) How many interface a class can implement? why
92) Does interface has constructor?
93) Can an interface extend another interface?
94) Can an interface extend from a class?
95) What is default access in interface?
96) What is default access in class?
97) What must be the access of method in class which
implements an interface?Why
98) Can we declare reference variable of interface? what
we can assign?
99) What is benefit of interface ?
100) What is marker interface?
101) abstract keyword can't be combined with which
keywords, why?
102) Can a class extend another class and implement
interface? explain
103) What is abstraction? how to achieve it?
104) What is the benefit of abstraction?
105) What is encapsulation?
106) What are the access specifier provided in java?
107) What is the use of private member variables?
108) What is the difference between package level
and protected members?
109) What is package?How to declare it?
110) What is the use of import statement?
111) What is static import statement?
112) What is java bean class? where it is used?
113) What is Singleton class? Where it is used?
114) What is inner class? What are the types of inner
class
115) What are the difference between abstract class
and interface?

Object,String and wrapper classes


1) What are the members of Object class?
2) Explain toString(), hashCode() and equals() method
of Object class
3) Why we need to override toString()?
4) Why we need to override hashCode() and equals();
5) What is String in java?
6) What is immutable object?
7) What are types of creating String object?
8) Explain Constant pool and non constant pool?
9) Explain difference between StringBuilder and
StringBuffer class?
10) What are classtype arrays?
Exception Handling
1) What is an exception in java?
2) State some situations where exceptions may arise in
java?
3) What is Exception handling in java?
4) What is an eror in Java?
5) What are advantages of Exception handling in java?
6) In how many ways we can do exception handling in
java?
7) List out five keywords related to Exception handling
?
8) Explain try and catch keywords in java?
9) Can we have try block without catch block?
10) Can we have multiple catch block for a try block?
11) Explain importance of finally block in java?
12) Can we have any code between try and catch blocks?
13) Can we have any code between try and finally
blocks?
14) Can we catch more than one exception in single catch
block?
15) What are checked Exceptions?
16) What are unchecked exceptions in java?
17) Explain differences between checked and Unchecked
exceptions in java?
18) What is default Exception handling in java?
19) Explain throw keyword in java?
20) Can we write any code after throw statement?
21) Explain importance of throws keyword in java?
22) Explain the importance of finally over return
statement?
23) Explain a situation where finally block will not be
executed?
24) Can we use catch statement for checked exceptions?
25) What are user defined exceptions?
26) Can we rethrow the same exception from catch
handler?
27) Can we nested try statements in java?
28) Explain the importance of throwable class and its
methods?
29) Explain when ClassNotFoundException will be
raised ?
30) Explain when NoClassDefFoundError will be raised
?

Mult-Threading
1) What is process ?
2) What is thread in java?
3) Difference between process and thread?
4) What is multitasking ?
5) What are different types of multitasking?
6) What are the benefits of multithreaded programming?
7) Explain thread in java?
8) List Java API that supports threads?
9) Explain about main thread in java?
10) In how many ways we can create threads in java?
11) Explain creating threads by implementing Runnable
class?
12) Explain creating threads by extending Thread class ?
13) Which is the best approach for creating thread ?
14) Explain the importance of thread scheduler in java?
15) Explain the life cycle of thread?
16) Can we restart a dead thread in java?
17) Can one thread block the other thread?
18) Can we restart a thread already started in java?
19) What happens if we don’t override run method ?
20) Can we overload run() method in java?
21) What is a lock or purpose of locks in java?
22) In how many ways we can do synchronization in
java?
23) What are synchronized methods ?
24) When do we use synchronized methods in java?
25) When a thread is executing synchronized methods ,
then is it possible to execute other synchronized methods
simultaneously by other threads?
26) When a thread is executing a synchronized method ,
then is it possible for the same thread to access other
synchronized methods of an object ?
27) What are synchronized blocks in java?
28) When do we use synchronized blocks and advantages
of using synchronized blocks?
29) What is class level lock ?
30) Can we synchronize static methods in java?
31) Can we use synchronized block for primitives?
32) What are thread priorities and importance of thread
priorities in java?
33) Explain different types of thread priorities ?
34) How to change the priority of thread or how to set
priority of thread?
35) If two threads have same priority which thread will
be executed first ?
36) What all methods are used to prevent thread
execution ?
37) Explain yield() method in thread class ?
38) Is it possible for yielded thread to get chance for its
execution again ?
39) Explain the importance of join() method in thread
class?
40) Explain purpose of sleep() method in java?
41) Assume a thread has lock on it, calling sleep()
method on that thread will release the lock?
42) Can sleep() method causes another thread to sleep?
44) Explain about interrupt() method of thread class ?
45) Explain about interthread communication and how it
takes place in java?
46) Explain wait(), notify() and notifyAll() methods of
object class ?
47) Explain why wait() , notify() and notifyAll() methods
are in Object class rather than in thread class?
48) Explain IllegalMonitorStateException and when it
will be thrown?
49) when wait(), notify(), notifyAll() methods are called
does it releases the lock or holds the acquired lock?
50) Explain which of the following methods releases the
lock when yield(), join(),sleep(),wait(),notify(),
notifyAll() methods are executed?
56) What are thread groups?
57) What are thread local variables ?
58) What are daemon threads in java?
59) How to make a non daemon thread as daemon?
60) Can we make main() thread as daemon?

Collection Framework
1) What is collections framework ?
2) What is collection ?
3) Difference between collection, Collection and
Collections in java?
4) Explain about Collection interface in java ?
5) List the interfaces which extends collection interface
?
6) Explain List interface ?
7) Explain methods specific to List interface ?
8) List implementations of List Interface ?
9) Explain about ArrayList ?
10) Difference between Array and ArrayList ?
11) What is vector?
12) Difference between arraylist and vector ?
13) Define Linked List and its features with signature ?
14) Define Iterator and methods in Iterator?
15) In which order the Iterator iterates over collection?
16) Explain ListIterator and methods in ListIterator?
17) Explain about Sets ?
18) Implementations of Set interface ?
19) Explain HashSet and its features ?
20) Explain Tree Set and its features?
21) When do we use HashSet over TreeSet?
22) What is Linked HashSet and its features?
23) Explain about Map interface in java?
24) What is linked hashmap and its features?
25) What is SortedMap interface?
26) What is Hashtable and explain features of Hashtable?
27) Difference between HashMap and Hashtable?
28) Difference between arraylist and linkedlist?
29) Difference between Comparator and Comparable in
java?
30) What is concurrent hashmap and its features ?
31) Explain about fail fast iterators in java?
32) Explain about fail safe iterators in java?

You might also like