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


Index Core Java Interview Ques ons


Download 1.52 Mb.
Pdf ko'rish
bet158/171
Sana07.01.2023
Hajmi1.52 Mb.
#1081886
1   ...   154   155   156   157   158   159   160   161   ...   171
Bog'liq
Core JAVA Interview Questions Youll M...

Index
Core Java Interview Ques ons
Section 1– Core Java
OOPs Concepts
Explain method overloading and method overriding.
Explain the benefits of OOPs.
Write a code snippet that demonstrates encapsulation.
What are the types of inheritance relationships?
What is the best practice in declaring instance variables?
What is a singleton class?
Explain what happens when the following code is compiled
and state whether it uses method overloading or overriding.
Write a Java code sample that demonstrates method
overloading.
What is polymorphism? How does Java support
Polymorphism?
Explain how Java achieves abstraction.
Java Basics


011.
012.
013.
014.
015.
016.
017.
018.
019.
020.
021.
022.
023.
024.
025.
What are the possible ways of declaring the Java main
method?
What are the possible ways of declaring a Java class?
How will you define an Identifier?
What are the modifiers that cannot be specified with an
instance variable?
What are the modifiers that can be specified with a method
declaration?
What will be the default value of a reference variable when it is
not explicitly initialized? How will you handle this in code?
Explain the keywords “transient” and “native”.
What is a comment in Java? Explain the types of comments
supported by Java.
Explain what is JVM, JRE and JDK.
Explain with a code sample how you will read a value entered
by a user.
Data Types, Variables and Arrays
What are the possible ways of declaring an array of short data
type?
How will you cast an int variable to byte explicitly? Is it really
necessary to cast int literal to byte?
Give an example of implicit casting.
Write a code snippet that demonstrate how you can assign a
float value to a short variable.
What is the default value for int, double, float, boolean, long
and char data types?


026.
027.
028.
029.
030.
031.
032.
033.
034.
035.
036.
037.
038.
039.
040.
041.
In the following code snippet, explain which lines will compile
fine and which will cause a compilation error.
Explain what happens when the following code is compiled.
You are given an assignment to create a game of Tic Tac Toe
using a multi–dimensional array. Which of the following is the
correct way to initialize the array?
Explain the primitive data types in Java.
What are the possible ways to assign a decimal number to a
float variable?
Identify the error in the following code snippet and explain how
it can be fixed.
How will you assign an Octal and Hexadecimal literal to an
“int” variable?
In the code snippet below, which lines will compile and which
will cause an error?
What happens when the following code is compiled and
executed?
Consider the following code snippet and explain its output.

Download 1.52 Mb.

Do'stlaringiz bilan baham:
1   ...   154   155   156   157   158   159   160   161   ...   171




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