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
- Write a Java program to print prime numbers using recursion
- CSS Overflow
- List out what are the build phases in Maven
- CSS Fonts
- Iterator Design Pattern
- How Spring detects what beans (components) are available in an application during component scanning process?
- Write a program to find possible permutations in given String in Java
- Java – Comments
- What is Synchronization in Java? Explain synchronized keyword.
- Java – Generics
- CSS How To
- Observer Design Pattern
- JavaScript Strings
- What is the use of super keyword in Java?
- Abstract Factory Design Pattern
- CSS Dropdowns
- Write a Java program to print first non-repeating character in given String
- Java – Programming Environment
- Hibernate Configuration
- Mediator Design Pattern