Skip to content

Instantly share code, notes, and snippets.

@technoAl
Created March 1, 2021 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technoAl/a16fc1b2636e503a38d08005610600b9 to your computer and use it in GitHub Desktop.
Save technoAl/a16fc1b2636e503a38d08005610600b9 to your computer and use it in GitHub Desktop.
public class Book {
private String name;
private String author;
private int publishingDate;
private int age;
public Book(String name, String author, int publishingDate, int age){
this.name = name;
this.author = author;
this.publishingDate = publishingDate;
this.age = age;
}
public void printBook(){
System.out.println(name + " by " + author);
}
public void increaseAge(){
age++;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getPublishingDate() {
return publishingDate;
}
public void setPublishingDate(int publishingDate) {
this.publishingDate = publishingDate;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment