Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- *
- * @author ilmi
- * @version 1.0.1
- */
- class MyClass
- {
- int height;
- MyClass()
- {
- System.out.println("bricks");
- height = 0;
- }
- MyClass(int i)
- {
- System.out.println("Building new House that is " + i + " feet tall");
- height = i;
- }
- void info()
- {
- System.out.println("House is " + height + " feet tall");
- }
- void info(String s)
- {
- System.out.println(s + ": House is " + height + " feet tall");
- }
- }
- public class MainClass
- {
- public static void main(String[] args) {
- MyClass t = new MyClass(0);
- t.info();
- t.info("overloaded method");
- //Overloaded constructor:
- new MyClass();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement