This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Duncan Atkinson

Greenhorn
+ Follow
since Sep 13, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Duncan Atkinson


Q: an anonymous inner class cannot have a constructor
A: true
-> doesn't it get a default constructor? Since you are creating an instance of the inner class with the new operator, it must have a constructor of some kind? Ofcourse I understand that you cannot specify a constructor yourself, because what would you name it..


It cannot have a constructor it can only use a construction block using {} only


Q: methods which are marked protected, can be called on any subclass of the class in which the method is declared
A: true
-> I believe it can be called IN any subclass, but not ON any instance of the subclass, unless it's in the same package. Is that right?


protected means it can be accessed from outside the package as well


Q: what happens when u divide an integer by a variable with value 0
A: RuntimeException
-> When it's a floating-point variable, no RuntimeException will be thrown


keyword here is integer not double.. i suppose if the variable was a floating point variable either double or float you would be ok


edit: another one that came to mind
Q: member (instance) variables are allways given a default value
A: true
-> Except for final member variables. They must be explicitly initialized (either in the declaration statement, in an initializer block or in each constructor)


member (instance) i think that all final variables are implicitly static also and therfor not instance / member


im still studying for my exam let me know if i have any of this wrong..