100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Java (Complete Key Notes + Interview Question-Answer)

Rating
-
Sold
-
Pages
36
Uploaded on
16-05-2023
Written in
2022/2023

My java notes contains all java key concepts in the form of question and answer, this pattern of making notes makes this notes very easy to understand any we are learning that specific topics.

Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Course

Document information

Uploaded on
May 16, 2023
File latest updated on
May 16, 2023
Number of pages
36
Written in
2022/2023
Type
Summary

Subjects

Content preview

Shivani Lunge

,Java Interview Questions i




Java Interview Questions

,Java Interview Questions ii




Contents


1 Object Oriented Programming (OOP) 1
1.1 Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.4 Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Differences between Abstraction and Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 General Questions about Java 3
2.1 What is JVM ? Why is Java called the Platform Independent Programming Language? . . . . . . . . . . . . . . 3
2.2 What is the Difference between JDK and JRE ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 What does the “static” keyword mean ? Can you override private or static method in Java ? . . . . . . . . . . . . 3
2.4 Can you access non static variable in static context ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.5 What are the Data Types supported by Java ? What is Autoboxing and Unboxing ? . . . . . . . . . . . . . . . . 4
2.6 What is Function Overriding and Overloading in Java ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.7 What is a Constructor, Constructor Overloading in Java and Copy-Constructor . . . . . . . . . . . . . . . . . . . 4
2.8 Does Java support multiple inheritance ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.9 What is the difference between an Interface and an Abstract class ? . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.10 What are pass by reference and pass by value ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Java Threads 6
3.1 What is the difference between processes and threads ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Explain different ways of creating a thread. Which one would you prefer and why ? . . . . . . . . . . . . . . . . 6
3.3 Explain the available thread states in a high-level. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.4 What is the difference between a synchronized method and a synchronized block ? . . . . . . . . . . . . . . . . 7
3.5 How does thread synchronization occurs inside a monitor ? What levels of synchronization can you apply ? . . . 7
3.6 What’s a deadlock ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.7 How do you ensure that N threads can access N resources without deadlock ? . . . . . . . . . . . . . . . . . . . 7

, Java Interview Questions iii



4 Java Collections 8
4.1 What are the basic interfaces of Java Collections Framework ? . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.2 Why Collection doesn’t extend Cloneable and Serializable interfaces ? . . . . . . . . . . . . . . . . . . . . . . . 8
4.3 What is an Iterator ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.4 What differences exist between Iterator and ListIterator ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.5 What is difference between fail-fast and fail-safe ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.6 How HashMap works in Java ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.7 What is the importance of hashCode() and equals() methods ? . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.8 What differences exist between HashMap and Hashtable ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.9 What is difference between Array and ArrayList ? When will you use Array over ArrayList ? . . . . . . . . . . . 9
4.10 What is difference between ArrayList and LinkedList ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.11 What is Comparable and Comparator interface ? List their differences. . . . . . . . . . . . . . . . . . . . . . . . 10
4.12 What is Java Priority Queue ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.13 What do you know about the big-O notation and can you give some examples with respect to different data
structures ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.14 What is the tradeoff between using an unordered array versus an ordered array ? . . . . . . . . . . . . . . . . . . 10
4.15 What are some of the best practices relating to the Java Collection framework ? . . . . . . . . . . . . . . . . . . 11
4.16 What’s the difference between Enumeration and Iterator interfaces ? . . . . . . . . . . . . . . . . . . . . . . . . 11
4.17 What is the difference between HashSet and TreeSet ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5 Garbage Collectors 12
5.1 What is the purpose of garbage collection in Java, and when is it used ? . . . . . . . . . . . . . . . . . . . . . . 12
5.2 What does System.gc() and Runtime.gc() methods do ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.3 When is the finalize() called ? What is the purpose of finalization ? . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.4 If an object reference is set to null, will the Garbage Collector immediately free the memory held by that object ? 12
5.5 What is structure of Java Heap ? What is Perm Gen space in Heap ? . . . . . . . . . . . . . . . . . . . . . . . . 12
5.6 What is the difference between Serial and Throughput Garbage collector ? . . . . . . . . . . . . . . . . . . . . . 13
5.7 When does an Object becomes eligible for Garbage collection in Java ? . . . . . . . . . . . . . . . . . . . . . . 13
5.8 Does Garbage collection occur in permanent generation space in JVM ? . . . . . . . . . . . . . . . . . . . . . . 13

6 Exception Handling 14
6.1 What are the two types of Exceptions in Java ? Which are the differences between them ? . . . . . . . . . . . . . 14
6.2 What is the difference between Exception and Error in java ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.3 What is the difference between throw and throws ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.4 What is the importance of finally block in exception handling ? . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.5 What will happen to the Exception object after exception handling ? . . . . . . . . . . . . . . . . . . . . . . . . 14
6.6 How does finally block differ from finalize() method ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
$6.49
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
ShivaniLunge

Get to know the seller

Seller avatar
ShivaniLunge Sant Gadge Baba Amaravati University
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
0
Documents
1
Last sold
-
Handmade Programming Notes With All Key Concepts

Here I upload my handmade notes that contains my complete research and study on that topic. I tried to make them as simple to understand as I could. I hope it will be very beneficial for you. So, Keep studying and keep growing.....

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions