Why Main
method()
dosent see public
method()
from the same package?
Class and method main:
public class Main {
public static void main(String[] args) {
Class c = new Class();
c. // dosent see public method1(), when Class c is called.
}
}
Class c:
public class C {
public static void method1(){
//logic
method2()
method3()
}
private static void method2(){
//logic
}
}
private static void method3(){
//logic
}
}
}
Method main
and Class c
locate in the same package, why method Main
dosent see public
method from the same package?
Class c contains static
content. method1()
is static
method. Thats why.