question.java
来自「一个用Java编写的问答程序」· Java 代码 · 共 56 行
JAVA
56 行
package qa;
public abstract class Question
{
private Answer answer;
private String questionText;
private Question hintQ;
protected Question()
{
}
protected Question(Answer a, String text)
{
answer = a;
questionText = text;
}
public void setAnswer(Answer a)
{
answer = a;
}
public Answer getAnswer()
{
return answer;
}
public void setQuestionText(String text)
{
questionText = text;
}
public String ask()
{
return questionText;
}
public void setHint(Question q) throws Exception
{
if (q.getAnswer() == hintQ.getAnswer())
{
throw new Exception();
}
else hintQ = q;
}
public String getHint()
{
return hintQ.ask();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?