+ 2
Can we make the java class private
If we can then where and what is the use
5 odpowiedzi
+ 2
The private access modifier is accessible only within the same class.
+ 1
Yes you can declare a class with private access specifier. But not in main class. You can declare private in inner classes only.
Below a example 
class Outer_Demo { 
int num; 
// inner class 
private class Inner_Demo { 
public void print() {
 System.out.println("This is an inner class");
 } }
+ 1
What is the use of making it private
+ 1
we cannot declare top level class as private.Java allows only public and default modifier for top level classes in Java. Inner classes can be private.
0
Thanks



