A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

这些题对现在的我来说就是天书,我还是努力学自己的吧,等到能力到了希望还有这样的活动
回复 使用道具 举报
刚入学,做题拓展下自己的知识面
回复 使用道具 举报
哎呀~还没学到呢~没基础的技术分帖子么?学渣没人权!
回复 使用道具 举报
学渣一枚~求带~
回复 使用道具 举报
import java.util.*; class  MapTest3 {         public static void main(String[] args)          {                 String s= charCount("ak+abAf1c,dCkaAbc-defa");                 System.out.println(s);         }                  public static String charCount(String str)         {                 char[] chs = str.toCharArray();                  TreeMap<Character,Integer> tm = new TreeMap<Character,Integer>();                                   int count = 0;                 for(int x=0; x<chs.length; x++)                 {                                                   if(!(chs[x]>='a' && chs[x]<='z' || chs[x]>='A' && chs[x]<='Z'))                                 continue;                          Integer value = tm.get(chs[x]);                                                   if(value!=null)                                 count = value;                         count++;                         tm.put(chs[x],count);//直接往集合中存储字符和数字,为什么可以,因为自动装箱。                          count = 0;                         /*                         if(value==null)                         {                                 tm.put(chs[x],1);                         }                         else                         {                                 value = value + 1;                                 tm.put(chs[x],value);                         }                         */                   }                  //System.out.println(tm);                  StringBuilder sb = new StringBuilder();                  Set<Map.Entry<Character,Integer>> entrySet = tm.entrySet();                 Iterator<Map.Entry<Character,Integer>>  it = entrySet.iterator();                  while(it.hasNext())                 {                         Map.Entry<Character,Integer> me = it.next();                         Character ch = me.getKey();                         Integer value = me.getValue();                         sb.append(ch+"("+value+")");                 }                    return sb.toString();         }  }
回复 使用道具 举报
我要答题
回复 使用道具 举报
在哪里咋哪里
回复 使用道具 举报
回复                          
回复 使用道具 举报
题呢在哪里 在哪里
回复 使用道具 举报
领题啦啦
回复 使用道具 举报
回复令题
回复 使用道具 举报
回帖领题   
回复 使用道具 举报
hava a look
回复 使用道具 举报
来咯!!
回复 使用道具 举报
:handshake
回复 使用道具 举报
我想试试,
回复 使用道具 举报
先看看什么题
回复 使用道具 举报
哎呦。。不错哦
回复 使用道具 举报
不错,不错。。。
回复 使用道具 举报
虽然还不会,但  赞一个!!!!!!!!!!!
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马