判斷並輸出500以內既能夠被3整除又能夠被6整除的整數。
public class ert {
/**
* @param args
*/
public static void main(String[] args) {
for (int i = 1; i <=500; i+=1){
if (i%3==0&&(i%6==0) {System.out.println(i);
}
}
}
}
public class ert {
/**
* @param args
*/
public static void main(String[] args) {
for (int i = 1; i <=500; i+=1){
if (i%3==0&&(i%6==0) {System.out.println(i);
}
}
}
}
要求用戶輸入一個年份(使用JOptionPane),判斷並輸出該年份是閏年還是平年。 注意判斷閏年的條件爲:(year%4==0&&year%100!=0) ||(year%400==0)
logic:match和logic:notMatch比較兩字符串是否相等,可以比較字符串的開始的、結尾的或其中的某個部分。location屬性:指定