- package heimaBlogQuesions;
- import java.io.*;
- import java.util.*;
- import javax.lang.model.element.Element;
- public class 猜字母 {
- public static String typeit() throws IOException
- {
- System.out.println("type it");
- BufferedReader bufr = new BufferedReader(new InputStreamReader(System.in));
-
-
- String str = bufr.readLine();
- return str;
- }
- public static char typeChar() throws IOException
- {
- System.out.println("type one character");
- //BufferedReader bufr = new BufferedReader(new InputStreamReader(System.in));
- InputStreamReader inr = new InputStreamReader(System.in);
-
-
- int cha;
- cha = inr.read();
- sop("cha:"+(char)cha);
- return (char)cha;
-
- }
- public static void sop(Object obj)
- {
- System.out.println(obj);
- }
- public static void main(String[] args) throws IOException {
- String str = typeit();
-
- sop(str);
- zidongcai(str);
-
- }
- public static String zidongcai(String str)
- {
- StringBuffer sb = new StringBuffer();
- char[] sar = str.toCharArray();
- for(int i = 0;i<sar.length;i++)
- {
- for(int j=0;j<=126;j++)
- {
- if((char)j == sar[i])
- {
- String string = String.valueOf(sar[i]);
- sb.append(string);
- }
- }
-
- }
- sop("sb:"+sb);
- return sb.toString();
- }
- }
复制代码 |