{"id":116,"title":"java\u6570\u636e\u7c7b\u578b","good":0,"bad":0,"hit":2011,"created_at":"2014-11-28 11:42:34","content":"

java\u516b\u5927\u57fa\u7840\u6570\u636e\u7c7b\u578b<\/p>

<\/p>

<\/p>

\u4f8b\u5b50\uff1a<\/strong><\/p>

public class Test03 {    public static void main(String[] args){        String name="\u5f20\u4e09";        byte age=30;        char sex='\u7537';        \/\/java\u4e2dfloat\u578b\u9ed8\u8ba4\u91c7\u7528\u7684\u53cc\u7cbe\u5ea6\uff0c\u8981\u4f7f\u7528\u5355\u7cbe\u5ea6\u8981\u5728\u672b\u5c3e\u52a0\u4e2af(\u4e0d\u533a\u5206\u5927\u5c0f\u5199)        float height=1.71f;        System.out.println("\u6211\u53eb"+name+",\u4eca\u5e74"+age+"\u5c81,\u6027\u522b"+sex+"\u8eab\u9ad8"+height);        \/\/Math.sqrt()\u8868\u793a\u5f00\u5e73\u65b9        System.out.println(Math.sqrt(2));        \/\/Math.random()\u4ea7\u751f\u4e00\u4e2a0-1\u4e4b\u95f4\u7684\u968f\u673a\u6570        System.out.println(Math.ceil(Math.random()*100));    }}<\/p>

\u8f93\u51fa\u7c7b\u4f3c\u4e8e\u4e0b\u9762\u7684\u7ed3\u679c\uff1a<\/p>

\u6211\u53eb\u5f20\u4e09,\u4eca\u5e7430\u5c81,\u6027\u522b\u7537\u8eab\u9ad81.711.414213562373095180.0<\/p>

<\/p>

\u4f8b\u5b50\uff1ajava\u6570\u636e\u7c7b\u578b\u7684\u8303\u56f4\u4e0e\u6570\u636e\u8f6c\u6362<\/strong><\/p>

public class Test2_7 {    \/\/\u5305\u88c5\u7c7b    public static void main(String args[]){        \/\/\u8f93\u51faByte\u7c7b\u578b\u7684\u6570\u636e\u8303\u56f4        System.out.println(Byte.MIN_VALUE+"~"+Byte.MAX_VALUE);        \/\/\u8f93\u51fashort\u578b\u7684\u6570\u636e\u8303\u56f4        System.out.println(Short.MIN_VALUE+"~"+Short.MAX_VALUE);        \/\/\u8f93\u51faint\u578b\u7684\u6570\u636e\u8303\u56f4        System.out.println(Integer.MIN_VALUE+"~"+Integer.MAX_VALUE);        \/\/\u8f93\u51fafloat\u578b\u7684\u6570\u636e\u8303\u56f4        System.out.println(Float.MIN_VALUE+"~"+Float.MAX_VALUE);        \/\/\u8f93\u51falong\u578b\u7684\u6570\u636e\u8303\u56f4        System.out.println(Long.MIN_VALUE+"~"+Long.MAX_VALUE);        \/\/\u5148\u5c06\u4e00\u4e2a\u5b57\u7b26\u4e32123\u8f6c\u4e3a\u6574\u578b\uff0c\u518d\u4e0e\u4e00\u4e2a\u6574\u5f62\u6570\u636e5\u76f8\u52a0,\u7ed3\u679c\u4e3a128        System.out.println(Integer.parseInt("123")+5);        \/\/\u5c06\u4e00\u4e2a\u6574\u578b\u6570\u636e-127\u8f6c\u6362\u4e3astring\u7c7b\u578b\u7684\u4e8c\u8fdb\u5236\u6570        System.out.println(Integer.toBinaryString(-127));        \/\/\u5c06\u4e00\u4e2a\u6574\u578b\u6570\u636e-127\u8f6c\u6362\u4e3astring\u7c7b\u578b\u768416\u8fdb\u5236\u6570        System.out.println(Integer.toHexString(-127));        \/\/\u5c06\u5b57\u7b26\u4e32-127\u8f6c\u4e3abyte\u578b\uff0c\u7136\u540e\u52a0\u6574\u65701\uff0c\u7ed3\u679c\u4e3a\u6574\u578b-126        System.out.println(Byte.parseByte("-127")+1);    }}<\/p>

<\/p>

\u8f93\u51fa\uff1a<\/p>

-128~127-32768~32767-2147483648~21474836471.4E-45~3.4028235E38-9223372036854775808~922337203685477580712811111111111111111111111110000001ffffff81-126<\/p>"}