上一页 1 2 3 4 5 6 7 ··· 80 下一页
摘要: //公共类 public class getRes{ //定义一个main方法 public static void main(String[] args){ //创建对像 AA a=new AA(); //调用方法 Scanner myScanner = new Scanner(System.in 阅读全文
posted @ 2025-05-06 13:35 胖豆芽 阅读(60) 评论(0) 推荐(0)
摘要: boolean res=a.getRes(num);//必须在主方法里调用此方法 System.out.println(res+" "); 阅读全文
posted @ 2025-05-06 13:29 胖豆芽 阅读(8) 评论(0) 推荐(0)
摘要: 错误原因: True 会被 Java 编译器当成一个未定义的标识符(可能是变量、类名等),而不是布尔值。 true 才是 Java 语言中表示“真”的关键字。 布尔值必须全小写,即 true 和 false,而不能写成 True 或 False 类似情况: null 也要小写,不能写成 Null 或 阅读全文
posted @ 2025-05-06 13:27 胖豆芽 阅读(32) 评论(0) 推荐(0)
摘要: 1.同一个类中调用方法 //公共类 public class getSum{ //定义一个main方法 public static void main(String[] args){ //创建对像 AA a=new AA(); //调用方法 a.sayOk(); } } //自定义类 class A 阅读全文
posted @ 2025-05-06 12:21 胖豆芽 阅读(9) 评论(0) 推荐(0)
摘要: /公共类 public class getSum{ //定义一个main方法 public static void main(String[] args){ //创建对像 AA a=new AA(); //调用方法 int arr []=a.getSumAndSub(1,4); System.out 阅读全文
posted @ 2025-05-06 11:40 胖豆芽 阅读(10) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2025-05-06 10:55 胖豆芽 阅读(6) 评论(0) 推荐(0)
摘要: import java.util.Random; //公共类 public class For02{ public static void main(String[] args){ //创建Person对像p1 Person p =new Person(); p.speak(); p.add(); 阅读全文
posted @ 2025-04-29 20:31 胖豆芽 阅读(6) 评论(0) 推荐(0)
摘要: import java.util.Random; //公共类 public class For02{ public static void main(String[] args){ //创建Person对像p1 Person a =new Person(); a.age=10; a.name="小明 阅读全文
posted @ 2025-04-29 19:56 胖豆芽 阅读(7) 评论(0) 推荐(0)
摘要: new对象的时候会在方法区 加载这个对象的属性和方法 阅读全文
posted @ 2025-04-28 19:26 胖豆芽 阅读(7) 评论(0) 推荐(0)
摘要: 先定义一个max=arr[0] 再从arr[1]开始循环到arr[arr.length-1] import java.util.Random; public class For02{ public static void main(String[] args){ int arr []={8,7,6, 阅读全文
posted @ 2025-04-28 18:55 胖豆芽 阅读(6) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 80 下一页