Core java interview Questions You'll Most Likely Be Asked (Second Edition)


Download 1.52 Mb.
Pdf ko'rish
bet161/171
Sana07.01.2023
Hajmi1.52 Mb.
#1081886
1   ...   157   158   159   160   161   162   163   164   ...   171
Bog'liq
Core JAVA Interview Questions Youll M...

Abstract Classes and Interfaces
What are the possible ways of declaring an interface?
Explain abstract class with a code sample.
Explain with a code sample how to implement an interface.
Is the following code snippet valid? Explain the reasons either
ways.
Can a class implement two interfaces? What will happen if
both the interfaces have a method with the same name?
What is the use of abstract classes?
Explain what is the issue with the following code snippet:
Is the following code snippet valid? Explain the reasons either
ways.
Which lines in the following code will cause a compilation
error?
Is the code snippet below valid? Explain.
Packages and Access Control
What is a package? What are the advantages of packages?
Explain the Java access specifiers.


113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
Explain with a code sample how to create a package.
Name some default packages in JDK and explain what they
do in brief.
Is the following code valid? Explain the reasons.
Explain the import keyword.
Explain the differences between the protected and default
access specifier.
Is the following code snippet valid? Explain.
Explain what happens when the following code is compiled
and executed:
Explain the java.lang package.
Excep on Handling
Explain ‘throw’, ‘throws’ and ‘Throwable’ in Java.
What will be the output when you compile and execute the
following code?
Write a code sample that demonstrates the try/catch/finally
block:
What will be the output on executing the code below?
Explain the try–catch–finally statement in Java.
What will be the output of the following code snippet?
Suppose you have a method called myMethod with some
code that can throw a checked Exception. How will you handle
this in the code?
What is the use of “finally” clause? Give an example.
Explain the differences between Error and Exception.
What is a RuntimeException?


131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.

Download 1.52 Mb.

Do'stlaringiz bilan baham:
1   ...   157   158   159   160   161   162   163   164   ...   171




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling