1. 程式人生 > 其它 >關鍵字和資料型別

關鍵字和資料型別

java 53個關鍵字和保留字

abstract class  extends implements null   strictfp   true
assert const false import package super try
boolean continue final instanceof private switch void
break default finally int protected synchronized volatile
byte do float interface public this while
case double for long return throw
catch else goto native short throws
char enum if new static transient

八大基本資料型別

public class Demo01 {
public static void main(String[] args) {
//八大基本資料型別
//整數
int num1 = 10; //最常用
byte num2 = 20;
short num3 = 30;
long num4 = 30L; //long型別要在數字後面加個L

//小數:浮點數
float num5 = 50.1F; //float型別要在數字後面加個F
double num6 = 3.141592653589793238462643;

//字元型別
char name = 'A';
//字串 String不是關鍵字,是一個類
String name1 = "大小";

//布林值:是非
boolean flag = true;
boolean flag1 = false;

}
}