摘要: 1 public class MethodParameter01{ 2 public static void main(String[] args){ 3 4 int a = 15; 5 int b = 10; 6 //创建对象AA对象 名字obj 7 8 AA obj = new AA(); 9 阅读全文
posted @ 2024-08-09 09:19 勤奋的小番茄 阅读(18) 评论(0) 推荐(0)
摘要: 1 public class MethodExercise01{ 2 public static void main(String[] args){ 3 4 AA a = new AA(); 5 if(a.isOdd(2)){//T,这样的写法以后会看到很多 6 System.out.println 阅读全文
posted @ 2024-08-08 11:06 勤奋的小番茄 阅读(21) 评论(0) 推荐(0)
摘要: 1 public class shuzu03{ 2 public static void main(String[] args){ 3 4 5 AA a = new AA(); 6 int[] res = a.getSumAndSub(1,4); 7 System.out.println("和=" 阅读全文
posted @ 2024-08-08 10:11 勤奋的小番茄 阅读(12) 评论(0) 推荐(0)
摘要: 1 public class shuzu21{ 2 //编写一个main方法 3 public static void main(String[] args){ 4 5 //编写一个数组,输出数组的各个元素值 6 int[][] map = {{0, 0, 1},{1, 1, 1},{1, 1, 3 阅读全文
posted @ 2024-08-07 10:01 勤奋的小番茄 阅读(22) 评论(0) 推荐(0)
摘要: 1 public class shuzu20{ 2 //编写一个main方法 3 public static void main(String[] args){ 4 5 //方法使用 6 //1.方法写好后,如果不去调用(使用),不会输出 7 //2.先创建对象,然后调用方法即可 8 Person 阅读全文
posted @ 2024-08-05 10:08 勤奋的小番茄 阅读(27) 评论(0) 推荐(0)
摘要: 1 public class maopao{ 2 //编写一个main方法 3 public static void main(String[] args){ 4 5 //冒泡排序 6 //要求从小到大 7 //要求从大到小 8 int[] arr = {20, -1, 89, 2, 890, 7} 阅读全文
posted @ 2024-08-03 08:30 勤奋的小番茄 阅读(9) 评论(0) 推荐(0)
摘要: 1 public class shuzu19{ 2 //编写一个main方法 3 public static void main(String[] args){ 4 /* 5 随机生成10个整数(1-100的范围)保存到数组 6 并倒序打印以及求平均值、求最大值和最大值的下标、 7 并查找里面是否有 阅读全文
posted @ 2024-08-02 11:04 勤奋的小番茄 阅读(201) 评论(0) 推荐(0)
摘要: 1 public class shuzu18{ 2 //编写一个main方法 3 public static void main(String[] args){ 4 5 /* 6 已知有个升序的数组,要求插入一个元素,该数组顺序依然是升序,比如: 7 [10, 12, 45, 90],添加23后,数 阅读全文
posted @ 2024-08-02 10:31 勤奋的小番茄 阅读(20) 评论(0) 推荐(0)
摘要: 1 public class shuzu10{ 2 //编写一个main方法 3 public static void main(String[] args){ 4 5 /* 6 1 7 1 1 8 1 2 1 9 1 3 3 1 10 1 4 6 4 1 11 1 5 10 10 5 1 12 1 阅读全文
posted @ 2024-08-02 09:03 勤奋的小番茄 阅读(37) 评论(0) 推荐(0)
摘要: 1 public class shuzu10{ 2 //编写一个main方法 3 public static void main(String[] args){ 4 /* 5 int arr[][] = {{4,6},{1,4,5,7},{-2}};遍历该二维数组,并得到和 6 7 8 思路 9 1 阅读全文
posted @ 2024-08-02 08:19 勤奋的小番茄 阅读(13) 评论(0) 推荐(0)