File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes abstract Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "abstract " Watch "abstract " New topic


Bradley Jordan
Ranch Hand

Joined: Feb 19, 2007
Posts: 42

that is my abstract code;
here is my subclass checking:

I am trying to complie that but getting this error:
accBalance has private access in Account
return ((accBalance - 700)* .02)* intrestPeriod; how do I get around this. I am only allowed to have the computeIntrest method take one integer arugment and return a double? I can add another variable to the method but that would violate the rule.
can anybody help with this?
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1710
Hi Jordon,

take accountbalance using the getter method. It is the proper
way, you can't access private variables of your parent class.


Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398
I would make the variables in the superclass that need to be used in the subclass protected.
Bradley Jordan
Ranch Hand

Joined: Feb 19, 2007
Posts: 42
thanks that worked...
I agree. Here's the link:
subject: abstract
It's not a secret anymore!