|
|
back to boardJava Runtime Error why? Hello, here is listing. Locally it works and prints the result. Don't understand why it causes the Runtime Error. Thanks. import java.io.IOException; import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int a = Integer.parseInt(reader.readLine()); int b = Integer.parseInt(reader.readLine()); System.out.println(a + b); } } Re: Java Runtime Error why? Try example as is - single line "1<space>5". Re: Java Runtime Error why? Edited by author 11.01.2017 18:30 Re: Java Runtime Error why? Posted by Himly 18 Apr 2017 22:01 你为什么要readLine呢 readLine是读取一行,一行怎么能转换为int类型呢,你应该获取一个字符,而不是使用Readline因为这是读取一行 |
|
|