Why are we able to call private java methods or variables from Groovy scripts?
GroovyMainClass.groovy -->
public class GroovyMainClass {
public static void main(String[] args) {
PrivateMethodClass pc = new PrivateMethodClass();
pc.privateMethod();
println "Private var ->"+pc.pVar;
}
}
PrivateMethodClass.java -->
public class PrivateMethodClass {
private int pVar = 1;
private void privateMethod(){
System.out.println("Private Method Called");
}
}