⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpletypecasting.java

📁 国外的数据结构与算法分析用书
💻 JAVA
字号:
public class SimpleTypecasting
{
	public static void main(String args[])
	{
		long l = 92;
		int i = (int) l;
		short s = (short) l;
		byte b = (byte) l;
		float f = (float) l;
		double d = (double) l;
		char c = (char) l;
//		boolean bol = (boolean) l;

		System.out.println("long: " + l);
		System.out.println("int: " + i);
		System.out.println("short: " + s);
		System.out.println("byte: " + b);
		System.out.println("float: " + f);
		System.out.println("double: " + d);
		System.out.println("char: " + c);

		l = 9876543210L;
		i = (int) l;
		s = (short) l;
		b = (byte) l;
		f = (float) l;
		d = (double) l;
		c = (char) l;
//		bol = (boolean) l;

		System.out.println("long: " + l);
		System.out.println("int: " + i);
		System.out.println("short: " + s);
		System.out.println("byte: " + b);
		System.out.println("float: " + f);
		System.out.println("double: " + d);
		System.out.println("char: " + c); // won't print
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -