ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1000. A+B Problem

Java Runtime Error why?
Posted by Invirtus 11 Jan 2017 17:33
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?
Posted by ToadMonster 11 Jan 2017 18:30
Try example as is - single line "1<space>5".
Re: Java Runtime Error why?
Posted by ToadMonster 11 Jan 2017 18:30


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因为这是读取一行