java 基本數據類類型有哪些?
八種基本類型
Byte 比特型
Short 短整型
Int 整型
Long 長整型
Float 單精度浮點型
Double 雙精度浮點型
Char 字符型
Boolean 布爾型
2.&和&&的區別
3.if和switch分支語句的區別
switch適合固定分支
if適合範圍內分支
4.while和do-while的區別
while先判斷後執行
do-while先執行後判斷
5.Eclipse常用快捷鍵有哪些?
ALT/ 補全命令
ctrl+shift+o 導包快捷鍵
ctrl+shift+f 代碼格式化快捷鍵
Ctrl加/ 多行註釋反註釋
/**加enter 註釋符
6.編程實現九九乘法表
package com.lenovo.www.commo;
public class JiuJiu {
public static void main(String[] args) {
for(int i=1;i<=9;i++) {
for(int j=1;j<=i;j++) {
System.out.print(i+"*"+j+"="+j*j+"\t");
}
System.out.println();
}
}
}
6判斷閏年
package com.lenovo.www.commo;
import java.util.Scanner;
public class NunnianPanduan {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int year = scan.nextInt();
if (year % 400 == 0 && year % 100 == 0) {
System.out.println("是閏年");
} else if (year % 4 == 0 && year % 100 != 0) {
System.out.println("是閏年");
}else {
System.out.println("不是閏年");
}
}
}