码迷,mamicode.com
首页 > 编程语言 > 详细

JAVA 各种数值类型最大值和最小值 Int, short, char, long, float,&nbs

时间:2016-05-29 06:22:14      阅读:253      评论:0      收藏:0      [点我收藏+]

标签:

代码片段:

byte bmax, bmin;

short shmax, shmin;

char cmax, cmin;

int imax, imin;

long lmax,lmin;

float fmax,fmin;

double dmax,dmin;

fmax = Float.MAX_VALUE;

fmin = Float.MIN_VALUE;

dmax = Double.MAX_VALUE;

dmin = Double.MIN_VALUE;

bmax = Byte.MAX_VALUE;

bmin = Byte.MIN_VALUE;

cmax = Character.MAX_VALUE;

cmin = Character.MIN_VALUE;

shmax = Short.MAX_VALUE;

shmin = Short.MIN_VALUE;

imax = Integer.MAX_VALUE;

imin = Integer.MIN_VALUE;

lmax = Long.MAX_VALUE;

lmin = Long.MIN_VALUE;

System.out.println("float max="+fmax);

System.out.println("float min="+fmin);

System.out.println("double max="+dmax);

System.out.println("double max="+dmin);

System.out.println("byte max="+bmax);

System.out.println("byte min="+bmin);

System.out.println("char max="+cmax);

System.out.println("char min="+cmin);

System.out.println("short max="+shmax);

System.out.println("short min="+shmin);

System.out.println("int max="+imax);

System.out.println("int min="+imin);

System.out.println("long max="+lmax);

System.out.println("long min="+lmin);

 

输出:

float max=3.4028235E38

float min=1.4E-45

double max=1.7976931348623157E308

double max=4.9E-324

byte max=127

byte min=-128

char max=?

char min=

short max=32767

short min=-32768

int max=2147483647

int min=-2147483648

long max=9223372036854775807

long min=-9223372036854775808

说明:

实际上是每种类型的Container类定义的常量。

JAVA 各种数值类型最大值和最小值 Int, short, char, long, float,&nbs

标签:

原文地址:http://www.cnblogs.com/wulianshang/p/5538813.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!