摘要: /* String name = "adsbsadgsadgtewterfsdf"; eg a-->6,b-->1 d-->3 ... 将字符串以a(字母)=>2(个数)存入Map集合框架中 思路:1.将字符串转换成字符数组. 2.定义一个Map集合,然后对字符数组进行遍历,如果Map集合中没有该元素就将该元素存入Map集合中,并定义一个计数器,将次数存入Map中,来达到目的*/import java.util.*;class CharMapDemo{ public static void main(String[] args) { String s 阅读全文
posted @ 2013-03-20 10:25 arvim 阅读(304) 评论(0) 推荐(0) 编辑
摘要: class ArrayTest{ public static void main(String[] args) { int[] arr;//对数组初始化 arr = new int[100]; for (int x = 0; x < 100 ;x++ ) {//对数组的每个元素进行赋值 arr[x] = x; } for (int x = 0; x < arr.length-1 ; x++ ) {//打印每个值 System.out.println(arr[x]); } }} 阅读全文
posted @ 2013-03-20 10:19 arvim 阅读(1407) 评论(0) 推荐(0) 编辑