RGAlex

Article

Feb 21st, 2021
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. package Exercise.O4Exersice;
  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 String getTitle() {
  15.         return title;
  16.     }
  17.  
  18.     public String getContent() {
  19.         return content;
  20.     }
  21.  
  22.     public String getAuthor() {
  23.         return author;
  24.     }
  25.  
  26.     @Override
  27.     public String toString() {
  28.         return String.format("%s - %s: %s", title, content, author);
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment