private的构造函数能直接使用?
public class SquareTool {
private String str;
private SquareTool() { //private
str = "nothing";
}
private class Contents{ //private
private void f(){ //private
System.out.println("In Class First's inner Class Contents method f()");
}
private void getStr(){
System.out.println("First.str="+str);
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SquareTool square = new SquareTool();
SquareTool.Contents contents = square.new Contents();
contents.f();
contents.getStr();
}
}
这个代码能跑过,里面的private限定符没起作用?