aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inner classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inner classes" Watch "Inner classes" New topic
Author

Inner classes

majohnad majohnad
Greenhorn

Joined: Jan 01, 2003
Posts: 24
Is the below statements are true?
"An abstact class must declare at least one abstract method"
"A local class can be declared abstract."


zxjohn
Rattan Mann
Ranch Hand

Joined: Jan 21, 2003
Posts: 44
You are right on both counts. In fact, local inner class can be declared only abstract or final. It can't be declared public, protected, private etc.
Rattan
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
"An abstact class must declare at least one abstract method"

False.
If the class contains 1 or more abstract methods, it must be declared abstract, but it is not required that a class contain an abstract method to be declared abstract.
"A local class can be declared abstract."

True.
An Inner Class isn't really that different from a top-level class - they can be abstract.
I hope that helps,
Corey


SCJP Tipline, etc.
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
hi majohnad
"An abstract class must declare at least one abstract method"
I make sure that the above statement is false
because abstract class can contains no abstract method.For example MouseAdapter or KeyAdapter.


Francis Siu
SCJP, MCDBA
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
An abstract class does not have to have any abstract methods, or any methods at all, but must be declared abstract if it has any abstract methods.
A method-local class (which is not an anonymous class) can be abstract. It can also be final or strictfp. No other modifiers are allowed, because such a class cannot be accessed from the outside, so the other modifiers make no sense.

[ April 21, 2003: Message edited by: Roger Chung-Wee ]

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inner classes