📄 doctor.java
字号:
package doctor1;
import java.io.*;
public class Doctor {
public static void main(String[] args) throws IOException {
Doctor dr = new Doctor();
try {
while (true) {
dr.talk(System.in, System.out);
}
} catch (IOException e) {
e.printStackTrace();
}
}
void talk(InputStream in, OutputStream out) throws IOException {
PrintWriter pw = new PrintWriter(out);
InputStreamReader ir = new InputStreamReader(in);
BufferedReader br = new BufferedReader(ir);
String question = br.readLine();
reply(pw, question);
}
void reply(PrintWriter pw, String question) throws IOException {
if (question.equals("I love you,Miss Ma!")) {
pw.println("I love you,too");
pw.flush();
}
else if (question.equals("Who are you?")) {
pw.println("I am Dactor Ma!");
pw.flush();
}
else if (question.equals("1+1=")) {
pw.println("haha ,I know,It's 2!");
pw.flush();
}
else {
pw.println("I am sorry!I don't know what You said!"
+ question + " what's it means!!! mm mm...");
pw.flush();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -