摘要: 1 public class ConstructorExercise { 2 //编写一个 main 方法 3 public static void main(String[] args) { 4 Person p1 = new Person();//无参构造器 5 //下面输出 name = nu 阅读全文
posted @ 2024-08-19 10:01 勤奋的小番茄 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1 public class OverLoadExercise{ 2 public static void main(String[] args){ 3 4 Methods stu = new Methods(); 5 6 7 System.out.println(stu.max(10,24)); 阅读全文
posted @ 2024-08-17 08:29 勤奋的小番茄 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1 public class hanoitower{ 2 public static void main(String[] args){ 3 4 Tower tower = new Tower(); 5 tower.move(6,'A','B','C'); 6 7 8 } 9 } 10 11 cla 阅读全文
posted @ 2024-08-15 09:06 勤奋的小番茄 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1 public class exercise02{ 2 public static void main(String[] args){ 3 4 /* 5 猴子吃桃子问题:有一堆桃子,猴子第一天吃了其中的一半,并多吃了一个! 6 以后每天猴子都吃其中的一半,然后再多吃一个。当到第10天时, 7 想再 阅读全文
posted @ 2024-08-11 10:36 勤奋的小番茄 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 1 public class Recursion01{ 2 public static void main(String[] args){ 3 T t1 = new T(); 4 t1.test(4);//输出什么? n=2 n=3 n=4 5 int res = t1.factorial(5); 阅读全文
posted @ 2024-08-11 09:19 勤奋的小番茄 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1 public class MethodExercise02{ 2 public static void main(String[] args){ 3 4 Person p = new Person(); 5 p.name = "milan"; 6 p.age = 100; 7 //创建tools 阅读全文
posted @ 2024-08-10 09:41 勤奋的小番茄 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 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 勤奋的小番茄 阅读(2) 评论(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 勤奋的小番茄 阅读(5) 评论(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 勤奋的小番茄 阅读(3) 评论(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 勤奋的小番茄 阅读(4) 评论(0) 推荐(0) 编辑