Is public keyword must require to declare a class?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is public keyword must require to declare a class??

If public keyword is not there can't we call the method outside??

19th Feb 2019, 3:40 AM
¿°°ANONYMOUS™~
¿°°ANONYMOUS™~ - avatar
2 Answers
+ 7
Public keyword is not necessary. We can call methods of private class outside too.
19th Feb 2019, 3:54 AM
Arushi Singhania
Arushi Singhania - avatar
+ 3
You can use public and call the private class https://en.m.wikibooks.org/wiki/Java_Programming/Keywords/public
19th Feb 2019, 3:59 AM
Markpeach96
Markpeach96 - avatar