摘要: public class Bit { public static void main(String[] args) { int num1 = 8; // 正数 int num2 = -8; // 负数 // 按位取反 int complement1 = ~num1; int complement2 阅读全文
posted @ 2023-09-15 11:08 刘梦磊 阅读(14) 评论(0) 推荐(0)
摘要: int X=100; int Y=200; System.*out*.println("X+Y="+X+Y); System.*out*.println(X+Y+"=X+Y"); 代码的结果:X+Y=100200 300=X+Y 原因:第一个"X+Y="相当于一开始就为字符串,所以后面那个+是拼接, 阅读全文
posted @ 2023-09-15 11:07 刘梦磊 阅读(9) 评论(0) 推荐(0)
摘要: 1.仔细阅读示例****: EnumTest.java,运行它,分析运行结果? public class EnumTest { public static void main(String[] args) { Size s=Size.SMALL; Size t=Size.LARGE; //s和t引用 阅读全文
posted @ 2023-09-15 10:57 刘梦磊 阅读(20) 评论(0) 推荐(0)
摘要: 浮点数加减乘除的计算是否会是一个准确值呢? public static class Main{ public static void main(String[] args) { System.out.println("0.51+0.1="+(0.51+0.01)); System.out.print 阅读全文
posted @ 2023-09-15 10:54 刘梦磊 阅读(8) 评论(0) 推荐(0)