title: Checking availability of Getters and Setters in Java
body: <p>I have a class Book with private variables bookName(type:String), bookPrice (type:int),authorName(type:String).I have included appropriate getters and setters methods for these private variables.</p>
  
  <p>Another class TestBook created which has main method.I need to get the details bookName,bookPrice,authorName from user. </p>
  
  <p>Object for book class created in Testbook class and assign the value for its attributes using the setters. Also to print the output output using the getters method. </p>
  
  <p>I wrote the entire code but getting failure.</p>
  
  <p>Fail1 : Check availability of getter/setter of bookName attribute
  Fail2 : Check availability of getter/setter of bookPrice attribute
  Fail3 : check availbility of getter/setter of authorName attribute</p>
  
  <p>Book.java</p>
  
  <pre><code> public class  Book {
  
           private String bookName;
           private int bookPrice;
           private String authorName;
  
           //getters
  
           public String getbookName(){
               return bookName;
           }
  
          public String getauthorName(){
                return authorName;
          }
          public int getbookPrice(){
              return bookPrice;
          }
  
         //setters
  
  
          public void setbookName(String newName){
               this.bookName = newName;
          }
          public void setbookPrice(int bokPrice){
              this.bookPrice = bokPrice;
          }
          public void setauthorName(String author){
              this.authorName = author;
          }
  
  
      }
  </code></pre>
  
  <p>TestBook.java</p>
  
  <pre><code> import java.util.Scanner;
  
       class TestBook {
  
           public static void main(String[] args){
           Scanner my = new Scanner(System.in);
  
           String name1,name2;
           int num;
  
          // Getting user input
  
          System.out.println("Enter the Book name:");
          name1 = my.nextLine();
  
          System.out.println("Enter the price:");
          num = my.nextInt();
  
          String re = my.nextLine();
  
          System.out.println("Enter the Author name:");
          name2 = my.nextLine();
  
          //Setting values of private variable using setters
  
          Book myObj = new Book();
          myObj.setbookName(name1);
          myObj.setbookPrice(num);
          myObj.setauthorName(name2);
  
          //Printing values using getters
  
          System.out.println("Book Details");
          System.out.println("Book Name :"+myObj.getbookName());
          System.out.println("Book Price :"+myObj.getbookPrice());
          System.out.println("Author Name :"+myObj.getauthorName());
  
  
  
          }
      }
  </code></pre>