为什么这样可以
一:while (i <= 100 ) {
// 变量 i 与 3 进行求模(取余),如果不等于 0 ,则表示不能被 3 整除
if (i % 3 != 0)
{
sum = sum + i; // 累加求和
}
i++;
}
二:while (i <= 100 && i%3 != 0) 就不行了?
一:while (i <= 100 ) {
// 变量 i 与 3 进行求模(取余),如果不等于 0 ,则表示不能被 3 整除
if (i % 3 != 0)
{
sum = sum + i; // 累加求和
}
i++;
}
二:while (i <= 100 && i%3 != 0) 就不行了?
2015-01-20
这是我的,不理解为什么不能加上int,一加就报错
three = one + two ;
System.out.println("three = one + two ==>"+ three);
three += one ;
System.out.println("three += one ==>"+ three);
three -= one ;
System.out.println("three -= one ==>"+ three);
......
three = one + two ;
System.out.println("three = one + two ==>"+ three);
three += one ;
System.out.println("three += one ==>"+ three);
three -= one ;
System.out.println("three -= one ==>"+ three);
......
2015-01-19
System.out.println("a等于b:" + (a==b));
System.out.println("a大于b:" + (a>b));
System.out.println("a小于等于b:" + (a<=b));
System.out.println("str1等于str2:" + (str1==str2));
System.out.println("a大于b:" + (a>b));
System.out.println("a小于等于b:" + (a<=b));
System.out.println("str1等于str2:" + (str1==str2));
2015-01-19