Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器 软件资源

软件开发小程序制作系统集成与运维空间租用硬件开发视频监控技术咨询与支持——联系电话:0311-88999002/88999003

首页 / 操作系统 / Linux / Java入门教程:数据类型举例

下例中用到了前面提到的数据类型,并通过屏幕显示它们的值。 public class SimpleTypes{ public static void main( String args[] ){ byte b=0x55; short s=0x55ff; int i=1000000; long l=0xfffL; char c="c"; float f=0.23F; double d=0.7E-3; boolean bool=true; System.out.println("b = "+b); System.out.println("s = "+s); System.out.println("i = "+i); System.out.println("c = "+c); System.out.println("f = "+f); System.out.println("d = "+d); System.out.println("bool = "+bool); } } 编译并运行该程序,输出结果为: C:>java SimpleTypes b = 85 s = 22015 i = 1000000 l = 4095 c = c f = 0.23 d = 0.0007 bool = true