Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.*;
- public class Main {
- static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- static StringTokenizer st;
- static PrintWriter pw = new PrintWriter(System.out);
- public static void main(String[] args) throws IOException {
- int n = readInt();
- String s = next(); // reads a string (not necessarily an entire line!)
- String entireLine = readLine();
- double myDouble = readDouble();
- pw.println("Use PrintWriter -- it's faster!");
- pw.print("PrintWriter is shorter to write (compared to System.out.println)\n");
- pw.println("But be careful when using PrintWriter in interactive problems " +
- "use pw.flush() to make sure pw prints before the next input!");
- pw.flush();
- pw.close(); // always write this line before ending the program!!
- }
- static String readLine() throws IOException {
- return br.readLine().trim();
- }
- static String next() throws IOException {
- while(st == null || !st.hasMoreTokens())
- st = new StringTokenizer(readLine());
- return st.nextToken();
- }
- static int readInt() throws IOException {
- return Integer.parseInt(next());
- }
- static double readDouble() throws IOException {
- return Double.parseDouble(next());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement