File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes private instance variable inside an abstract class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "private instance variable inside an abstract class" Watch "private instance variable inside an abstract class" New topic
Author

private instance variable inside an abstract class

Francis Palattao
Ranch Hand

Joined: Sep 22, 2004
Posts: 91
I expected the compiler to complain because I dont see the point of allowing private class variables. I know private methods are not allowed in an abstract class but why is the compiler not complaining is there a use for this case.



SCJP 1.4 <br />SCWCD 1.4 (preparing)<br />SCBCD 1.3 (coming soon)
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
An abstract class can have non-abstract methods that use the private variable.

By the way, an abstract class can have private methods. No class can have a private abstract method, as there would be no way to implement that method in a subclass.


Mike Gershman
SCJP 1.4, SCWCD in process
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: private instance variable inside an abstract class
 
Similar Threads
can we have private methods in an abstract class?
abstract method within an enum ?
Abstract and private ??
Question on c:set target=""
regarding abstract