一个java 的小知识点
class TestTwo
{
public static void main(String [] args)
{
boolean a=false;
if (a=true)
{
System.out.println("this is true programe");
}
else
{
System.out.println("I don't known");
}
}
}
输入的结果是this is true programe 为什么呢 书上说是因为a被赋予true
那如果是这个样子的话 那么 下面的一段代码
class TestTwo
{
public static void main(String [] args)
{
boolean a=false;
if (a=false)
{
System.out.println("this is true programe");
}
else
{
System.out.println("I don't known");
}
}
}
这个的输出结果 却是 I don't known 呢
是不是说对于boolean型的就是true 型 呢