public class A{
public static void main(String[] args)
{
String s; // String s =null; 改成这样,即可通过编译 ;
int x = 99;
if (x < 100) s = "x is less than 100";
if (x > 100) s = "x is greater than 100";
System.out.println(s.length());
}
}
如果按找你的定义, 系统会提示s没有初始化;
|