GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaTutorial/src/F014_ReadingInput.java at master · windweb/JavaTutorial Expand file tree/ Copy pathF014_ReadingInput.javaMore file actions 17 lines (13 loc) · 808 Bytes / Copy pathF014_ReadingInput.javaFile metadata and controls17 lines (13 loc) · 808 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import java.util.Scanner; public class F014_ReadingInput { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); // объявляем сканер, где System.in - поток ввода данных в консоль System.out.print("Enter your age: "); // печатаем в консоль строку "Enter your age: " byte age = scanner.nextByte(); // читаем байт с клавиатуры System.out.println("You are " + age + " years old"); System.out.print("Enter your name: "); Scanner scanner2 = new Scanner(System.in); String name = scanner2.nextLine().trim(); // читаем строку с удалением пробелов System.out.println("Your name is " + name); } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |