Advertisement
ilminottaken

Untitled

Oct 12th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. /**
  2.  *
  3.  *
  4.  * @author ilmi
  5.  * @version 1.0.1
  6.  */
  7. class MyClass
  8. {  
  9.     int height;  
  10.     MyClass()
  11.     {  
  12.      System.out.println("bricks");  
  13.      height = 0;  
  14.     }  
  15.     MyClass(int i)
  16.     {  
  17.      System.out.println("Building new House that is "  + i + " feet tall");  
  18.      height = i;  
  19.     }  
  20.     void info()
  21.     {  
  22.      System.out.println("House is " + height + " feet tall");  
  23.     }  
  24.     void info(String s)
  25.     {  
  26.      System.out.println(s + ": House is "  + height + " feet tall");  
  27.     }  
  28. }  
  29. public class MainClass
  30. {  
  31.     public static void main(String[] args) {  
  32.      MyClass t = new MyClass(0);  
  33.      t.info();  
  34.      t.info("overloaded method");  
  35.      //Overloaded constructor:  
  36.      new MyClass();  
  37.     }  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement