public void get() throws IOException { //1. Properties pr=new Properties(); String path=this.getClass().getResource("/db.xml").getPath(); FileInputStream fr=new FileInputStream(path); pr.load(fr); String url=pr.getProperty("url"); //2. String string="dasdqehjhgradasdasd"; String max_str=""; int max_cs=0; while(string.length()>0) { String first=string.substring(0, 1); string.replaceAll(first, ""); int length=string.length(); if(max_cs<length) { max_cs=length; max_str=first; } } //3. String temp=""; for(int i=string.length();i>=0;i--) { temp=temp+string.charAt(i-1); } System.out.println(temp); }
面试:1.怎么读取src下面的文件2.怎么取出string字符串里面出现最多的字符3.怎么倒叙排列字符
猜你喜欢
转载自www.cnblogs.com/anlegou/p/9340234.html
今日推荐
周排行