当前位置: 首页 > news >正文

新网站收录多少关键词动漫设计需要什么基础

新网站收录多少关键词,动漫设计需要什么基础,在自己电脑上做网站,网站优化 前端怎么做1.键盘录入一个字符串#xff0c;求该字符串中每一个字符出现的次数。 要求#xff1a;按照字母顺序打印 如: 录入的字符串为apple#xff0c;打印 a(1) e(1) l(1) p(2) public class Demo4 {public static void main(String[] args) {//键盘录入Scanner sc n…1.键盘录入一个字符串求该字符串中每一个字符出现的次数。 要求按照字母顺序打印 如: 录入的字符串为apple打印 a(1) e(1) l(1) p(2) public class Demo4 {public static void main(String[] args) {//键盘录入Scanner sc new Scanner(System.in);System.out.println(请输入字符串);String str sc.nextLine();//创建treeMap存储字符【键】个数【值】TreeMapCharacter, Integer map new TreeMap();//遍历输入的字符串//方法一str.length() str.charAt(i)得到每一个字符for (int i 0; i str.length(); i) {//得到每一个字符char ch str.charAt(i);//判断键在集合中是否存在if(map.containsKey(ch)){//如果存在则获取对应的值Integer value map.get(ch);//将值1并存入集合中map.put(ch,value1);}//否则不存在则值为1直接存入else {map.put(ch,1);}}//方法二s/*char[] charArr str.toCharArray();for (int i 0; i charArr.length; i) {if(map.containsKey(charArr[i])){//如果存在则获取对应的值Integer value map.get(charArr[i]);//将值1并存入集合中map.put(charArr[i],value1);}//否则不存在则值为1直接存入else {map.put(charArr[i],1);}}*///打印集合//录入的字符串为apple打印 a(1) e(1) l(1) p(2)SetMap.EntryCharacter, Integer entries map.entrySet();for (Map.EntryCharacter, Integer entry : entries) {System.out.print(entry.getKey()(entry.getValue()) );}System.out.println();} }打印结果 ----------------------------------------------------------------- 请输入字符串 asdagfasfas a(4) d(1) f(2) g(1) s(3) 使用HashMap集合存储Student对象作为键学生的家庭住址作为值 要求要求学生的姓名和年龄不能重复 使用TreeMap集合存储Student对象作为键学生的家庭住址作为值 要求先按照年龄进行排序再按照姓名进行排序 测试类 public class Demo3 {public static void main(String[] args) {//1. 使用HashMap集合存储Student对象作为键学生的家庭住址作为值// 要求要求学生的姓名和年龄不能重复HashMapStudent, String hashMap new HashMap();hashMap.put(new Student(张三,20),武汉);hashMap.put(new Student(李四,21),孝感);hashMap.put(new Student(王五,20),武汉);hashMap.put(new Student(张三,22),安陆);hashMap.put(new Student(张三,20),汉川);//键值对遍历SetMap.EntryStudent, String entries hashMap.entrySet();for (Map.EntryStudent, String entry : entries) {System.out.println(entry.getKey()...entry.getValue());}//2. 使用TreeMap集合存储Student对象作为键学生的家庭住址作为值// 要求先按照年龄进行排序再按照姓名进行排序System.out.println(----------------------);TreeMapStudent, String treeMap new TreeMap();treeMap.put(new Student(zhangsan,20),武汉);treeMap.put(new Student(lisi,21),孝感);treeMap.put(new Student(wangwu,20),武汉);treeMap.put(new Student(zhangsan,22),安陆);treeMap.put(new Student(zhangsan,20),汉川);//键找值遍历SetStudent keys treeMap.keySet();for (Student key : keys) {String value treeMap.get(key);System.out.println(key...value);}} }打印结果 --------------------------------------------------------------- Student{name王五, age20}...武汉 Student{name张三, age22}...安陆 Student{name张三, age20}...汉川 Student{name李四, age21}...孝感 ---------------------- Student{namewangwu, age20}...武汉 Student{namezhangsan, age20}...汉川 Student{namelisi, age21}...孝感 Student{namezhangsan, age22}...安陆学生类 public class Student implements ComparableStudent {private String name;private int age;public Student(String name, int age) {this.name name;this.age age;}public Student() {}public String getName() {return name;}public void setName(String name) {this.name name;}public int getAge() {return age;}public void setAge(int age) {this.age age;}Overridepublic String toString() {return Student{ name name \ , age age };}Overridepublic boolean equals(Object o) {if (this o) return true;if (o null || getClass() ! o.getClass()) return false;Student student (Student) o;if (age ! student.age) return false;return name ! null ? name.equals(student.name) : student.name null;}Overridepublic int hashCode() {int result name ! null ? name.hashCode() : 0;result 31 * result age;return result;}Overridepublic int compareTo(Student o) {int result this.age-o.age;result result 0 ? this.getName().compareTo(o.getName()) : result;return result;} }
http://www.pierceye.com/news/235080/

相关文章:

  • 做网站运营这工作怎么样北京网站优化价格
  • 河南专业网站建设网站怎么做高权重
  • 国内大型电子网站建设做网站时怎么透明化
  • 微应用和微网站的区别手机网站开发的目的
  • 网站ico开一个网站建设公司好
  • wordpress中文站cn外贸网站怎么换域名
  • 淘宝客怎么做直播网站吗学校网站建设发展概况分析
  • 广州网站外贸推广建筑师必看的16部纪录片
  • 深圳网站建设平台网站右侧浮动广告
  • 中英文网站源码浙江东南网架公司
  • 个人备案网站放什么资料培训
  • html做企业门户网站提供设计的网站
  • 成都三合一网站建设成年s8视频加密线路
  • 做网站购买服务器如何优化网络
  • 企业公司网站 北京怎样用前端知识制作企业网站
  • 精湛的赣州网站建设襄阳哪里有做网站的
  • 拿了网赌代理后怎样做自己的网站河南最新消息今天
  • 北京最大的网站开发公司中山市企业网站seo营销工具
  • 苏州营销型网站建设方案哪些网站做的比较好的
  • 淘宝上买的建设网站能退款吗app怎么查网站备案
  • 电子商务网站开发与设计报告专业网站建设公司兴田德润怎么样
  • 如何建立p2p网站win2003怎么做网站
  • 免费网页设计制作网站建筑公司愿景口号大全
  • 个人可以做网站维护吗专业团队电脑壁纸
  • 东营专业网站建设公司排行鞍山市人力资源招聘信息网
  • 郑州网站建设蝶动小公司使用的网站开发
  • 合肥网站seo技术软件开发工程师简历模板
  • org的域名网站在线取公司名字 免费
  • 网站开发有哪几个阶段百度网站官网怎么做
  • 微信网站名域名访问网站怎么下载