📄 posting.java
字号:
package forum;
/**
* The superclass of all postings - for example Topics and Responses.
*
* @author Simon Brown
*/
public abstract class Posting {
/** the id of this posting */
protected int id;
/** the text (i.e. the posting) */
protected String text;
/** the user that made this posting */
protected User user;
/**
* Creates a new posting.
*
* @param user the User that made the posting
* @param text the text of the posting
*/
public Posting(User user, String text) {
this.user = user;
this.text = text;
}
/**
* Gets the id associated with this posting.
*
* @return the id
*/
public int getId() {
return this.id;
}
/**
* Setter for the id property.
*
* @param id the new id
*/
public void setId(int id) {
this.id = id;
}
/**
* Getter for the user property.
*
* @return the user that made this posting
*/
public User getUser() {
return this.user;
}
/**
* Getter for the text property.
*
* @return the text
*/
public String getText() {
return this.text;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -