摘要:
总结:使用方法原理弄清楚package com.a;public class gjsopb { public static void main(String[] args) { int a[] = { 2, 35, 43, 654, 3, 1 }; int b[] = new int[a.length]; //clone类型返回的是对象,要强制转换为:int[] b = (int[]) a.clone(); for (int i = 0; i < a.length; i++) { System.out.println(b[i]); } }} 阅读全文
posted @ 2013-11-03 09:27
juewang
阅读(309)
评论(0)
推荐(0)
摘要:
总结:理解理解。重要啊package com.a;import java.util.Arrays;public class FJKDLS { public static void main(String[] args) { int[] a = { 12, 3, 35, 43 }; int b[] = new int[a.length]; System.arraycopy(a, 0, b, 0, a.length); for (int i = 0; i < b.length; i++) { System.out.println(b[i] + " "); } System 阅读全文
posted @ 2013-11-03 09:13
juewang
阅读(549)
评论(0)
推荐(0)
摘要:
总结:主要是用a数组的长度等于b数组,然后a数组赋值给b数组,我不能想到这个办法,我还是不理解数组中length属性的含义这里数组并没有正真复制过来,而是一个引用package com.a;//数组的复制public class DKF { public static void main(String[] args) { int a[] = { 3, 46, 5, 6, 8, 4, 34 }; int length = a.length; int b[] = new int[length]; for (int i = 0; i < length; i++) { b[i] = a[i... 阅读全文
posted @ 2013-11-03 08:14
juewang
阅读(229)
评论(0)
推荐(0)
摘要:
总结:输出最大值,最小值,可以先排序,再输出就容易点了。不用循环判断。我还没学。但是觉得很好用package com.aini;import java.util.Arrays;import java.util.Scanner;//求把数组里的元素,输出最大值,最小值,平均值public class PAI { public static void main(String[] args) { Scanner c = new Scanner(System.in); System.out.println("请输入10个数--------"); int a[] = new int[ 阅读全文
posted @ 2013-11-03 01:18
juewang
阅读(1104)
评论(0)
推荐(0)
摘要:
总结:有一定基础的人,应该发现第一个程序可以运行,其实它有个致命的错误。有谁能一眼看出来呢?第二个程序是对的。这个题目求最大值,最小值,平均值我不会求,不知道这个if判断放在类的外面还是main函数里面我不知道方法在哪里。没有思路。当我把循环放在main函数里面的时候,package com.c2;import java.util.Scanner;//求输入一组数据,求其最大值,最小值,平均值public class Qi { public static void main(String[] args) { Scanner c = new Scanner(System.in); int a.. 阅读全文
posted @ 2013-11-03 00:42
juewang
阅读(8906)
评论(0)
推荐(0)
浙公网安备 33010602011771号