Advertisement
OpKaTa

Untitled

Feb 21st, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. package ArticleProblem;
  2.  
  3. public class Article {
  4. private String title;
  5. private String content;
  6. private String author;
  7.  
  8. public Article(String title, String content, String author) {
  9. this.title = title;
  10. this.content = content;
  11. this.author = author;
  12. }
  13.  
  14. public void edit(String content) {
  15. this.content = content;
  16. }
  17.  
  18. public void changeAuthor(String author) {
  19. this.author = author;
  20. }
  21.  
  22. public void rename(String title) {
  23. this.title = title;
  24. }
  25. @Override
  26. public String toString() {
  27. String result = String.format("%s - %s: %s", this.title, this.content, this.author);
  28. return result;
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement