java - Class Cannot Be Resolved To A Variable -
i trying cast component custom class name (outerspace) , says cannot this. doing in class inherits jframe.
//add game jframe add(new outerspace()); (outerspace)(getcomponents()[0]).start();
it cannot resolved however, other class name. here error-
outerspace cannot resolved variable.
this looks wrong:
(outerspace)(getcomponents()[0]).start();
it done:
((outerspace)getcomponents()[0]).start();
having said this, regardless of right or wrong, code looks fragile , dangerous kludge. if project, i'd try hold more secure class-specific reference outerspace field, 1 not require casting, or require component in specific component array position.
Comments
Post a Comment