⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tongjizifu.txt

📁 统计输入字母的个数! 界面没有做
💻 TXT
字号:
public class 字母个数
{

public static void main(String[] fdfd)
{
sum("asdASDasd&*(");
}

static void sum(String str)
{
HashMap hash = new HashMap();

for(int i = 0;i < str.length();i++)
{
if(hash.containsKey(str.charAt(i)))
{
hash.put(str.charAt(i),(Integer)hash.get(str.charAt(i))+1);
}
else
{
hash.put(str.charAt(i),1);
}
}

for (Iterator it = hash.entrySet().iterator(); it.hasNext(); )
  {
  Map.Entry entry = (Map.Entry) it.next();
  System.out.println(entry.getKey()+"---------"+entry.getValue());
  
  }
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -