/** * @Author DragonOne * @Date 2021/9/4 19:40 */ publicclassMain{ publicstaticvoidmain(String[] args)throws Exception { Scanner Scin = new Scanner(System.in); StreamTokenizer STcin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); BufferedReader BRcin = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
String s; // STcin.nextToken(); // s = STcin.sval; //有问题
// s = BRcin.readLine();
s = Scin.next(); int len = s.length(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < len; i++) { if(s.charAt(i)=='1'){ sb.append("hongliyu"); }elseif(s.charAt(i)=='2'){ sb.append("lvliyu"); }elseif(s.charAt(i)=='3'){ sb.append("lv"); } } out.println(sb); out.flush(); } }
报错:
1 2 3
Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:23)