i 绝望

依然

Miss Lang
  2013年10月27日
摘要: 总结:理解二维数组的一维循环,package com.b;//求长度public class Coo { public static void main(String[] args) { int a[][] = { { 2, 432, 23 }, { 3, 5, 346, 4 }, { 3, 26, 546, 7 } }; int sum = 0; for (int i = 0; i < a.length; i++) {// 循环第一维的下标 sum += a[i].length; } System.out.println(sum);// 数组中总的元素个数 }} 阅读全文
posted @ 2013-10-27 19:46 juewang 阅读(978) 评论(0) 推荐(0) 编辑
摘要: 总结:对于循环的理解还是不够,不知道输出的结果放在哪一个括号后面package com.c2;//求数组元素中最大的值public class Css { public static void main(String[] args) { int a[][] = { { 1, 3, 5, 2 }, { 9, 87, 65, 34 }, { 2, 13, 1 } }; int max = a[0][0]; for (int i = 0; i < a.length; i++) { for (int j = 0; j < a.length; j++) { if (max < a[i] 阅读全文
posted @ 2013-10-27 19:11 juewang 阅读(172) 评论(0) 推荐(0) 编辑
摘要: package com.c2;//求数组元素中最大的值public class Css { public static void main(String[] args) { int a[][] = { { 1, 3, 5, 2 }, { 9, 87, 65, 34 }, { 2, 13, 1 } }; int max = a[0][0]; for (int i = 0; i < a.length; i++) { for (int j = 0; j < a.length; j++) { if (m... 阅读全文
posted @ 2013-10-27 19:08 juewang 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 真是学了后面忘了前面,一维数组都忘了package com.c2;//总结类型转换不对,导致运行报错//以及没有new,导致空指针异常//引入流。import java.io.*;public class Col { private String name; private float weight; public void setName(String b) { name = b; } public String getName() { return name; } public void setWeight(float a) { weight = a; } public float ... 阅读全文
posted @ 2013-10-27 11:18 juewang 阅读(4114) 评论(0) 推荐(0) 编辑
摘要: package com.c2;//注意数据类型,floatpublic class Col {// public static void main(String[] args) { float m[] = new float[4]; float sum = 0; m[0] = 3; m[1] = 1; m[2] = 4; for (int i = 0; i < m.length; i++) { sum += m[i]; // 求一维数组的平均值 } System.out.println(sum / 3); }} 阅读全文
posted @ 2013-10-27 09:36 juewang 阅读(1390) 评论(0) 推荐(0) 编辑
摘要: 总结:二维数组理解不了,,,,求解析。。。package com.c2;public class Aaa { // 求数组元素中最大的 public static void main(String[] args) { int a[][] = { { 1, 3, 4 }, { 2, 1, 5 }, { 6, 3, 2 } }; int max = a[0][0]; for (int i = 0; i max) { max = a[i][j]; } } } System.out.println("" + max); }} 阅读全文
posted @ 2013-10-27 00:05 juewang 阅读(2066) 评论(0) 推荐(0) 编辑

绝望依然

Miss Lang