Computer Science, asked by rajiv1144, 1 year ago

Difference between public class s{ } and class s{ } in java?

Answers

Answered by ayushnimak
0

Simply, the public class only represents that the methods and variables of the class are accessible to other classes. However, in some applications such as BlueJ, classes are automatically public, and declaring public is not necessary.


rajiv1144: If that is private class s{ } then?
Answered by mn121
0

There is no difference as class is declared as public by default.... Using public class s{} shows that they are public....


rajiv1144: If that is private class s{ } then?
ayushnimak: Private class makes it so that it is only available within the sub class, not necessarily the entire class as a whole.
rajiv1144: Can u elaborate
Similar questions