Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.65 KB  |  views: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Class Car {
  2.  
  3.     private Engine engine;
  4.  
  5.     public void setEngine(Engine engine){
  6.      this.engine=engine;
  7.     }  
  8.  
  9.     public Engine getEngine(){
  10.      return engine;
  11.     }
  12. }
  13.        
  14. Public House {
  15.    private Room room;
  16.    Public House (){
  17.       room = new Room (int noRooms, String nameOfHouse);
  18.  
  19.    }
  20. }
  21.        
  22. public class Example {
  23.  
  24.     public static void main(String[] args) {
  25.         Person p1 = new Person("Vishal");
  26.         Company abc = new Company(p1);
  27.     }
  28.  
  29.  
  30. }
  31.  
  32. class Person{
  33.     String name;
  34.     public Person(String name) {
  35.         this.name = name;
  36.     }
  37. }
  38.  
  39. class Company{
  40.     Person employee;
  41.     public Company(Person p1) {
  42.         employee = p1;
  43.     }
  44. }