-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
25 lines (21 loc) · 761 Bytes
/
Copy pathTest.java
File metadata and controls
25 lines (21 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
Read two integers from an input file and output their sum
*/
/*
ID: anastas11
LANG: JAVA
TASK: test
*/
import java.io.*;
import java.util.*;
class test {
public static void main (String[] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("test.in")); //input file name
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("test.out"))); //output file name
StringTokenizer st = new StringTokenizer(f.readLine()); //breaks up the input file into tokens
int i1 = Integer.parseInt(st.nextToken()); //parses each token into an integer
int i2 = Integer.parseInt(st.nextToken()); //parses each (second) token into an integer
out.println(i1 + i2); //output result
out.close(); //close output file
}
}