+ 1

What is the difference between class with public in the front and class without public?

5th Mar 2016, 6:17 AM
Yusuf Faisal (Pro Encoder)
Yusuf Faisal (Pro Encoder) - avatar
4 Answers
+ 4
Class with public access specifier can be accessed within the class, other classes and other packages too, whereas without access specifier it will become default access specifier which means that it will be accessed only within the current class and only in the same package.
7th Mar 2016, 8:41 AM
Sreesanth Thekke Veettil
Sreesanth Thekke Veettil - avatar
+ 1
U are making me confused here!! Class without access specifier is considered as default specifier. while in C++ it is treated as private
24th Jun 2016, 7:18 AM
Saud Ahmad
Saud Ahmad - avatar
0
Class without 'public' modifier in front of it means it is implicitly 'default'. 'default' modifier gives it package level access i.e. that class can be accessed anywhere within package only.
17th Oct 2016, 2:02 PM
Nikhil Shrivastav
Nikhil Shrivastav - avatar
- 1
Class definition without modifier will indeed be considered as 'private'.
8th May 2016, 11:21 AM
Pasupathy Devaraj
Pasupathy Devaraj - avatar