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