📄 readline.java
字号:
//==============================================================
// ReadLine.java - Prompt user to enter a string
//
// Java学习源代码检索系统 Ver 1.0 20031015 免费正式版
// 版权所有: 中国IT认证实验室(www.ChinaITLab.com)
// 程序制作: ChinaITLab网校教研中心
// 主页地址: www.ChinaITLab.com 中国IT认证实验室
// 论坛地址: bbs.chinaitlab.com
// 电子邮件: Java@ChinaITLab.com
//==============================================================
import java.io.*;
public class ReadLine {
// Input a string
public static String readLine()
throws IOException {
BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
return br.readLine();
}
// Prompt for and input a string
public static String readLine(String prompt)
throws IOException {
System.out.print(prompt);
return readLine();
}
// Main program
public static void main(String args[])
throws IOException {
System.out.println("Enter strings when prompted.");
System.out.print("Enter your first name: ");
String s1 = readLine();
String s2 = readLine("Enter your last name: ");
System.out.println("Your name: " + s1 + " " + s2);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -