Thursday, 15 September 2011

java - The method is undefined for the type string -



java - The method <method> is undefined for the type string -

ok, have super class getter method below:

public string getborrowerid(){ homecoming borrowerid; }

and have subclass new array declared instance variable store userids:

private string [] resqueue = new string[5];

and borrow method variable called 'borrowerid' passed in parameter have compare first id in array borrowerid :

if( borrowerid == resqueue[0].getborrowerid()) { super.borrow(borrowerid); rescount--;

however, error "the method getborrowerid() undefined type string" on line:

if( borrowerid == resqueue[0].getborrowerid())

any ideas?

getborrowerid() defined in 1 of classes , not in string, phone call call though string reference.

you can phone call through instance of class contains it. example, if class contains getborrowerid() called yourclass, can phone call method way:

yourclass var = new yourclass(); string id = var.getborrowerid();

java arrays inheritance methods

No comments:

Post a Comment