- 博客(2)
- 收藏
- 关注
原创 读取算法题输入的字符串与字符的方法
1.读取单行(多行)字符串:使用BufferedReader中的readLine()方法。 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); 2.读取单个字符:使用System.in.read()方法。 char c = (char)System.in.read(); 注意:此方法返回值为字符的ASCII码,需要强转为char类型。 ...
2020-09-17 16:36:24
200
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人