Can I create a public method inside a default class? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

Can I create a public method inside a default class?

How this Public method is accessible to all classes as this method is a part of default class?

22nd Jan 2018, 6:15 AM
Kamal Bisht
Kamal Bisht - avatar
1 Antwort
+ 1
Technically, I guess the method *would* have been visible anywhere, but since you won't be able to instantiate the class outside the package you wont be able to use it, so is essentially package visible
22nd Jan 2018, 7:36 AM
Dan Walker
Dan Walker - avatar