这两个方法只是长得像而已 是完全不同的两个东西…
readLine()和nextLine()
nextLine()是Scanner类下的一个方法,功能如上图。
readLine()和nextLine()
readLine()是BufferedReader类下的一个方法。使用该方法需要try-catch

注意:涉及到IO传输的方法多数都需要处理异常的
RuntimeExcetion在代码中无需显式处理。
非RuntimeException必须明确地给出解决方案,否则无法通过编译。
**为什么RuntimeException无需处理?
java中的所有方法都是默认throws RuntimeException的。

readLine()和nextLine()
readLine()和nextLine()

相关文章:

  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-09
猜你喜欢
  • 2021-04-21
  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
  • 2021-04-16
  • 2021-11-04
相关资源
相似解决方案