//数据类型以及类型转换
public class Holle {
public static void main(String[] args){
//小数类型
double a = 1314D/100;
System.out.println(a);
float b = 1314F/100F;
System.out.println(b);
//整数类型
int c = 1314/100;
System.out.println(c);
//字符类型(最多表示2个字节,1个中文字是2个字节)
char d = 65;//十进制算法
System.out.println(d);
char f = '中';//单引号表述
System.out.println(f);
System.out.println('中');
//引用数据类型
System.out.println(7+8+"holle");
String e = "中国新说唱";
System.out.println(e);
//强制转换符赋值
double g = 3.14;
System.out.println(g);
int h = (int)g;//强制转换
System.out.println(h);
//字符前的\表示转义符,后面的字符会原样输出
System.out.println("\"你好\"");
}
}
JAVA基础初学数据类型以及类型转换
猜你喜欢
转载自blog.csdn.net/qq_42801561/article/details/81220997
今日推荐
周排行