Consider the following code in which the HelloWorld class has default access or batch access:
class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!");
And suppose the above code is saved in a file called HelloWorld.java . So my question is: since HelloWorld now a private class package, how does it work? The main() method should not be visible or accessible through packages, right?
It makes sense to me if the HelloWorld class is declared public. Confusion occurs only when it is advertised using the default private package.
java jvm package
anon1981 03 Oct 2018-11-11T00: 00Z
source share