随笔分类 -  JAVA学习 / Text2

方法、
摘要:Text2-综合练习 需求:定义一个方法copyArray(int arr[],int from,int to) 功能:将数组arr中索引from(包含from)开始。 刀索引to结束(不包含to)的元素复制到新数组中, 将新数组返回 public static void main(String[] 阅读全文
posted @ 2025-01-13 19:07 chi_yu 阅读(2) 评论(0) 推荐(0) 编辑
摘要:Text-方法的练习3 需求:定义一个方法判断数组中的某一个数是否存在,将结果返回给调用处 public static void main(String[] args) { int arr[]={1,2,4,7,5,44,77,66,99}; System.out.println(exist(arr 阅读全文
posted @ 2025-01-13 18:33 chi_yu 阅读(5) 评论(0) 推荐(0) 编辑
摘要:Text-方法的练习2 需求:设计一个方法求数组的最大值,并将最大值返回 public static void main(String[] args){ int arr[]={1,7,44,88,99,2}; int max=numberMax(arr); System.out.println(ma 阅读全文
posted @ 2025-01-13 18:32 chi_yu 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Text-方法的练习1 需求:设计一个方法用于数组遍历,要求遍历的结果是在同一行上的。例如:[11,22,33,44,55] public static void main(String[] args) { int arr[]={11,22,33,44,55}; printArr(arr); } p 阅读全文
posted @ 2025-01-13 18:32 chi_yu 阅读(3) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示