Advertisement
MeGaM1nd

Untitled

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