我想在运行时追加一个字符串,但此代码再次添加上一个单词而不是追加新单词。在字符串中追加文本
Customer.java:
public String getCustomerQuestion() {
return CustomerQuestion;
}
public void setCustomerQuestion(String customerQuestion) {
CustomerQuestion = customerQuestion;
}
public void appendmessage(String msg){
CustomerQuestion = CustomerQuestion +" "+ msg;
}
Main.java:
Customer _Customer =new Customer();
Request_Message Request= new Request_Message;
_Customer.setCustomerQuestion(Request.getInput());
String _string=Request.getInput();
_Customer.appendmessage(_string);
String str=__Customer.getCustomerQuestion();
System.out.println("now new Question() is"+str);
当我将RAM写入,然后按当我写这辛格结果显示后再次进入:在控制台砣砣。 我想显示ram singh作为一个字符串。 `public class Request_Message { {0}私人String _Input;
public void setInput(String line) { _Input = line; } public String getInput() { return _Input; }`
它需要从聊天窗口输入。
有没有这样的对象作为'__Customer'?实例变量的命名方案也很奇怪。大写字母? – 2010-11-19 08:07:51
为什么在示例中的其他任何地方使用_Customer时,您在名为_ITChatParticipant的对象上使用getCustomerQuestion?这是一个错字吗? – Erik 2010-11-19 08:09:19