Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.javarush.test.level06.lesson08.task04;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- /* Класс ConsoleReader
- Сделать класс ConsoleReader, у которого будут 4 статических метода:
- String readString() – читает с клавиатуры строку
- int readInt() – читает с клавиатуры число
- double readDouble() – читает с клавиатуры дробное число
- void readLn() – ждет нажатия enter [использовать readString()]
- */
- public class ConsoleReader
- {
- public static String readString() throws Exception
- {
- BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
- String name = in.readLine();
- return name;
- }
- public static int readInt() throws Exception
- {
- return Integer.parseInt(readString());
- }
- public static double readDouble() throws Exception
- {
- return Double.parseDouble(readString());
- }
- public static void readLn ()throws Exception
- {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- while (reader.read() != '\n' )
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement