摘要: public class AutoBoxingExample { public static void main(String[] args) { // 自动装箱示例 int primitiveInt = 10; // 这里Java自动将int类型的primitiveInt包装成Integer类型 阅读全文
posted @ 2024-12-19 16:24 tting111 阅读(19) 评论(0) 推荐(0)
摘要: 动物 public class Animal { //创建动物类 类中包含eat方法 public void eat(){ System.out.println("吃东西"); return; } } public interface AnimalInfo { void fly(); } public c 阅读全文
posted @ 2024-12-10 22:47 tting111 阅读(11) 评论(0) 推荐(0)
摘要: 定义两个类ChineseAirConditioner(Z国空调)和AmericanAirConditioner(M国空调),执行下面代码: public class Main { public static void main(String[] args) { System.out.println( 阅读全文
posted @ 2024-11-29 15:23 tting111 阅读(10) 评论(0) 推荐(0)