daily pastebin goal
48%
SHARE
TWEET

MainClass

d-stv Oct 12th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  *
  3.  *
  4.  * @author Steve
  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. }
RAW Paste Data
Top