mirror of
https://github.com/emrullah-enis-ctnky/Classes_example_project_JAVA.git
synced 2025-07-05 17:49:36 +00:00
45 lines
664 B
Java
45 lines
664 B
Java
|
package classesTemplate;
|
||
|
|
||
|
public class Book {
|
||
|
private String title;
|
||
|
private String author;
|
||
|
private int isbn;
|
||
|
private boolean isAvailable;
|
||
|
|
||
|
public Book(String title, String author, int isbn, boolean isAvailable) {
|
||
|
this.author = author;
|
||
|
this.isAvailable = isAvailable;
|
||
|
this.isbn = isbn;
|
||
|
this.title = title;
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
public void displayInfo() {
|
||
|
System.out.println("Kitap ismi=" + title + "\nYazar=" + author + "\nISBN=" + isbn);
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
public void borrowBook() {
|
||
|
if (isAvailable) {
|
||
|
|
||
|
isAvailable = false;
|
||
|
|
||
|
} else {
|
||
|
|
||
|
System.out.println("Kitap daha önce ödünç verilmiş!");
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
public void returnBook() {
|
||
|
isAvailable = true;
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|