Top level classes in java can’t be private or protected, but inner classes in java can. The reason for not making a top-level class as private is very obvious, because nobody can see a private class and thus, they cannot use it. Declaring a class as protected also doesn’t make any sense. The only difference between default visibility and protected visibility is that we can use it in any package by inheriting it. Since in java there is no such concept of package inheritance, defining a class as protected is no different from default.
Read More
- HTML Editors
- Structural Design Patterns
- Factory Method Design Pattern
- Java – Package
- Fly Weight Design Pattern
- Write a Java program to check if given String are anagram
- What is Autoboxing and Unboxing in Java?
- Microservices – Service Routing
- What is the difference between innerHTML and innerText?
- HTML Colors
- CSS Height/Width
- Explain how you can exclude dependency?
- Microservices – Hystrix Dashboard
- JavaScript Switch
- Write a Java program to print fibonacci series using recursion
- HTML Introduction
- Java main method
- HTML Links
- Builder Design Pattern
- Java – History