📄 j02050202.java
字号:
import java.lang.*;
class j02050202
{
public static void main(String para[])
{
Byte B1 = new Byte((byte)100); //一定要转型,否则100 视为 int 型态
Byte B2 = new Byte("120");
Short S1= new Short((short)1000); //一定要转型,否则1000 视为 int 型态
Short S2 = new Short("2000");
Long L1 = new Long(10000000L);
Long L2 = new Long("20000000"); //传字符串不可以加修饰符号L
Float F1 = new Float(31.46F); // 一定要加修饰符号 F
Float F2 = new Float("55.245"); //传字符串不可以加修饰符号F
Double D1 = new Double(53.1D); //加不加修饰符号 D 都可以
Double D2 = new Double("66.3676"); //传字符串不可以加修饰符号D
Boolean Bool1 = new Boolean(true);
Boolean Bool2 = new Boolean("TRUE"); //大小写不拘:True,TRUe,trUe,...都可以
Character C1 = new Character('A');
System.out.println("B1=" + B1.byteValue()
+" B2="+B2.byteValue() );
System.out.println("S1=" + S1.shortValue()
+" S2="+B2.shortValue() );
System.out.println("L1=" + L1.longValue()
+" L2="+L2.longValue() );
System.out.println("F1=" + F1.floatValue()
+" F2="+F2.floatValue() );
System.out.println("D1=" + D1.doubleValue()
+" D2="+D2.doubleValue() );
System.out.println("Bool1=" + Bool1.booleanValue()
+" Bool2="+Bool2.booleanValue() );
System.out.println("C1=" + C1.charValue());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -