| 我的理解是: String s="sss";//做了两件事在1.常量池中创建匿名变量x="sss"(x作用域只在1中有效);2.String s=new String(x);
 x声明在if下的第一句,但是却在下一句被使用,超出作用域了
 对于三元运算符也会发生报错的状况:不知道什么原因
 代码如下
 复制代码if(age>18)
                        true?System.out.println("yes"):System.out.println("no");
错误如下:
 No exception of type void can be thrown; an exception type must be a subclass of Throwable
 有对这个比较熟悉的吗
 
 
 
 |