class StringLianXi
{
public StringLianXi(int a)
{
sop(a);
}
static int x;
public static void main(String[] arr)
{
String s="abcdefgabcdefg";
StringLianXi slx=new StringLianXi(3);
//sop(slx.stringLength(s));
//stpr();
slx.stringLength(s);
System.out.println(x);
}
public int stringLength(String str)
{
x=str.length();
//sop(x);
return x;
} }
为什么x 不定义成静态会编译失败呢?
|
|