Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Illegal Access Error

Status
Not open for further replies.

mpenny

Programmer
Jan 5, 2002
4
US
Hi. Can you help me with this?

I'm getting an illegal access error: try to access class Item from class Cart3

I tried importing the class Item into the class Cart3 with an import statement - got the error
I tried making Item public - got the error
I tried adding Item as a class to Cart3 - got the error

I don't know what to do. The errors come when the the line:
item = new Item item; is called in my method:
public void addItem (HttpServletRequest request, ServletOutputStream out) throws IOException

and again in my doGet:
if (operation.equalsIgnoreCase ("add") ) {
addItem (request, out);}

What am I missing? What usually causes this type of error? Where should I look?
Thanks for help.
 
I don't think the line

item = new Item item;

would even compile. You would have to have something like

Item item = new Item();

Can you provide a more complete block of code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top