Top 500+ Advanced Java Interview Questions 2020-2021 - 3
Question: 11
What do you understand by private, protected and public?
These are accessibility modifiers. Private is the most restrictive, while public is the least restrictive.
There is no real difference between protected and the default type within the context of the same package; however the protected keyword allows visibility to a derived class in a different package.
Question: 12
What is a compilation unit?
A compilation unit is a Java source code file.
Question: 13
How are this() and super() used with constructor?
this() is used to invoks a constructor of the same class, super() is used to invoke a super class’s constructor.
Question: 14
What is the difference between declaring a variable and defining a variable?
In declaration we just mention the type of the variable and its name. We do not initialize it.
But defining means declaration + initialization.
E.g. String s; is just a declarations while String s = new String (“abcd”); or String s = “abcd”; are both definitions.
Question: 15
Is a class a sub class of itself?
A class is a subclass of itself.
- Java Interview Questions and Answers
- Top 1000+ Java Interview Questions and Answers Pdf
- Top 500+ Advanced Java Interview Questions 2020-2021
- Java Interview Questions and Answers for Freshers Pdf
- Java Interview Questions and Answers for Experienced Pdf
- Java Programming Basics Interview Questions
- Java OOPS Interview Questions for 3 years experienced
- Basic Java Programs Asked in Interview with Answers Pdf
- Java Programming Interview Questions and Answers
- C | C++ | Java Interview Questions and Answers
Analog Electronics Questions Pdf Download with Answers More
Engineering Materials Science MCQ Questions & Answers More
Material Science MCQ Questions Pdf Download More
Dairy Technology MCQ Questions and Answers More
Agricultural Engineering MCQ Questions & Answers Pdf More
7000+ Sports Questions and Answers for SSC CGL 2024 - 2025 Pdf More
100+ Computer Knowledge Questions and Answers in Hindi More
1000+ Civil Engineering Quiz Questions and Answers More
Analytical puzzles with answers for interviews More
PG TRB Physics Online Test More