|
|
вернуться в форумI don't know, why it crashes Послано mari 2 фев 2011 16:51 Here is my solution. It works fine in eclipse, but it crashes in here. Could you tell me what is wrong? import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Sum {
public static void main(String[] args) {
int x,y; long z;
try { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); x = Integer.parseInt(bf.readLine()); y = Integer.parseInt(bf.readLine()); bf.close(); z = x+y; System.out.println(z); } catch (IOException e) { System.out.println(e); }
} } Re: I don't know, why it crashes Test: 1 2 (in one line) Verdict: Crash Besides BufferedReader use java.util.StringTokenizer (better) or java.io.StreamTokenizer. |
|
|