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

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -