Advertisement
RandomGuy32

Aufgabe D3: NewsItem

Nov 29th, 2019
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1. import java.util.Date;
  2.  
  3. public class NewsItem {
  4.     private String url;
  5.     private String title;
  6.     private String description;
  7.     private Date publicationDate;
  8.  
  9.     public String getUrl() {
  10.         return this.url;
  11.     }
  12.  
  13.     public void setUrl(String url) {
  14.         this.url = url;
  15.     }
  16.  
  17.     public String getTitle() {
  18.         return this.title;
  19.     }
  20.  
  21.     public void setTitle(String title) {
  22.         this.title = title;
  23.     }
  24.  
  25.     public String getDescription() {
  26.         return this.description;
  27.     }
  28.  
  29.     public void setDescription(String description) {
  30.         this.description = description;
  31.     }
  32.  
  33.     public Date getPublicationDate() {
  34.         return this.publicationDate;
  35.     }
  36.  
  37.     public void setPublicationDate(String publicationDate) {
  38.         this.publicationDate = new Date(publicationDate);
  39.     }
  40.  
  41.     @Override
  42.     public String toString() {
  43.         return this.title + "\n" + this.description + "\n" + this.url + "\n" + this.publicationDate.toLocaleString() + "\n================================";
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement