Advertisement
Guest User

Java

a guest
Dec 13th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. public class mainClass{
  2.         public static void main(String[] args){
  3.                 System.out.println("I am a main class.");
  4.                 book sample1 = new book();
  5.                 copier sample2 = new copier("This",16,"That");
  6.                 copier sample3 = new copier("That",17,"Unknown");
  7.         }
  8. }
  9.  
  10. class copier{
  11.         copier(book b){
  12.                 this.book_name = b.book_name;
  13.                 this.price = b.price;
  14.                 this.type = b.type;
  15.         }
  16.  
  17.         copier(String name, double price, String type){
  18.                 this.name = name;
  19.         }
  20. }
  21.  
  22. class book{
  23.         String book_name="This one";
  24.         double price=16;
  25.         String type="Science";
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement