An exercise about overriding/overloading:

Which methods can be inserted at line 1 and line 2 for the code to compile and run

without error?

publicclass MyClass{

publicstaticvoid main(String[] argv){

}

void amethod(int i){

}

//line 1

}

class MySubclassextends MyClass{

// line 2

}

Here are the methods:

1- protected void amethod(int i) throws Exception {}

2- public int amethod(int i) {return 0;}

3- void amethod(int i) throws RuntimeException{}

4- private int amethod(int i) {return 0;}

The method to be inserted at Line 2 is obvious but for Line 1? Thanks for the help.

[1209 byte] By [blutch009a] at [2007-11-27 8:01:56]
# 1
Have you actually tried to run it and see?
hunter9000a at 2007-7-12 19:44:03 > top of Java-index,Java Essentials,Training...
# 2
Are take home finals out already?
Hippolytea at 2007-7-12 19:44:03 > top of Java-index,Java Essentials,Training...
# 3
> Are take home finals out already?It's the end of the first summer semester here in the US, so probably.
hunter9000a at 2007-7-12 19:44:03 > top of Java-index,Java Essentials,Training...
# 4
> It's the end of the first summer semester here in the> US, so probably.I aced my Real Estate Investments final. Yeehaw. Only two more classes to go...~
yawmarka at 2007-7-12 19:44:03 > top of Java-index,Java Essentials,Training...
# 5
You're going to be a broker?! Or is that just part of a different major?
hunter9000a at 2007-7-12 19:44:03 > top of Java-index,Java Essentials,Training...
# 6
> You're going to be a broker?! Or is that just part of a different major?No intention on being a broker; it's an MBA elective (focus on finance/accounting). ~
yawmarka at 2007-7-12 19:44:03 > top of Java-index,Java Essentials,Training...
# 7

> > You're going to be a broker?! Or is that just

> part of a different major?

>

> No intention on being a broker; it's an MBA elective

> (focus on finance/accounting).

>

> ~

Congrats, though why any self-respecting software guy would want a business degree is beyond me ;P

hunter9000a at 2007-7-12 19:44:03 > top of Java-index,Java Essentials,Training...
# 8
> Congrats, though why any self-respecting software guy would want a business degree is beyond me ;PI hear even Bill Gates got himself a degree, this month.
Hippolytea at 2007-7-12 19:44:03 > top of Java-index,Java Essentials,Training...
# 9
> > Congrats, though why any self-respecting software> guy would want a business degree is beyond me ;P> > I hear even Bill Gates got himself a degree, this> month.Good, maybe he'll be able to get a good job now... :|
hunter9000a at 2007-7-12 19:44:03 > top of Java-index,Java Essentials,Training...