0

can we made a class as private?

we all know, by default access modifier of a class is public but can we made the access modifier as private of a class if Yes/No then why?

25th Jun 2016, 11:02 AM
RAHUL GUPTA
3 Antworten
+ 1
sorry to correct u but default and public both are different access modifier with different properties. And yes we can make class private but not main class as it throw error at compile time.
29th Jun 2016, 10:35 AM
sarvesh patel
sarvesh patel - avatar
0
yes, but if you do it as private, you can't be able to use out of the class where is this method
25th Jun 2016, 10:26 PM
Santiago Herrera
Santiago Herrera - avatar
0
thans to correct me
29th Jun 2016, 12:27 PM
Santiago Herrera
Santiago Herrera - avatar