java - unable to instantiate class within method? -
i trying instantiate object following class:
public class name { //the unmodified name private string name; //the modified name private string preprocessedname; /** * constructor method stores original name in name variable * @param inputname */ public name(string inputname){ //store name this.name = inputname; //initialise preprocessedname this.preprocessedname = null; } /** * retrieves original name * @return original name */ public string getname(){ return this.name; } /** * stores preprocessed name in preprocessedname variable * @param preprocessed name */ public void setpreprocessedname(string processedinput){ this.preprocessedname = processedinput; } /** * retrieves preprocessed name * @return preprocessed name */ public string getpreprocessedname(){ return this.preprocessedname; } }
within following method:
/** * private method instantiates names name object. * @param names */ private void processinput(arraylist<string> names){ library = new arraylist<name>(); for(string name : names){ name tempname = new name("r"); //not bringing methods class **strong text**tempname.**strong text** //add library library.add(tempname); } }
i unable use methods name class when create object, know why happening? e.g. not bring getters , setters class when try auto completion.
check imports have in package. importing correct name class?
Comments
Post a Comment