SHARE
TWEET

Untitled

ookhai Jul 1st, 2012 27 Never
  1. //book clas
  2. public class Books {
  3.  
  4.     // data members
  5.         private String booksName;
  6.         private String booksAuthor;
  7.     private String booksEdition;
  8.     private int rackNo;
  9.  
  10.         // constructor
  11.         public Books(String booksName, String booksAuthor, String booksEdition, int rackNo) {
  12.                 this.booksName = booksName;
  13.                 this.booksAuthor = booksAuthor;
  14.                 this.booksEdition = booksEdition;
  15.                 this.rackNo = rackNo;
  16.         }
  17.         // toString method
  18.         public String toString() {
  19.                 return String.format("\t%-10s %-10s %-10s \t\t%d", booksName, booksAuthor, booksEdition, rackNo);
  20.         }
  21.        
  22.        
  23. }
RAW Paste Data
Top