1try {
2 File file = new File("data.txt");
3 BufferedReader reader = new BufferedReader(new FileReader(file));
4 String line;
5
6 while((line = reader.readLine()) != null) {
7 System.out.println(line);
8 }
9} catch(IOException e) {
10 e.printStackTrace();
11}
1import java.io.BufferedReader;
2//
3BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
4System.out.println(reader.readLine());
1class Main {
2 public static void main (String[] args) throws IOException{
3
4 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
5 String[] str = br.readLine().split(" "); // 6 2
6 String[] input = br.readLine().split(" "); // 1 2 3 4 5 6
7
8
9 int n = Integer.parseInt(str[0]); // 6
10 int k = Integer.parseInt(str[1]); // 2
11
12
13 int [] arr = new int [n];
14
15 for(int i=0; i<n; i++)
16 {
17 arr[i] = Integer.parseInt(input[i]); // 1 2 3 4 5 6
18 }
19
20
21 }
22}
23
1private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
2private static StringTokenizer st;
3static String next() throws IOException {
4 while (st==null||!st.hasMoreTokens()) {
5 st = new StringTokenizer(br.readLine().trim());
6 }
7 return st.nextToken();
8}
9static long readLong() throws IOException {
10 return Long.parseLong(next());
11}
12static int readInt() throws IOException {
13 return Integer.parseInt(next());
14}
15static double readDouble() throws IOException {
16 return Double.parseDouble(next());
17}
18static String readLine() throws IOException {
19 return br.readLine().trim();
20}