java - ClassCastException when eclipse "fixed" my code -


I get a classcast exception when Eclipse suggested that my code should be such ..

I have a class called class.

  Arreelist & lt; Cort & gt; Corat = new arreelist & lt; Cort & gt; ();  

Then I use toArray () , and Eclipse suggests that it should look like: Kort [] array = (Kort [] ) Kort.toArray () ;

But this gives me the exception: Classcast exception! : (

What can you do:

  Kort [] Array = kort.toArray (new cort [kort.size ()]);  

This is considered to be better, because it keeps type protection on the array. If you do not care / If you want to ignore the suggestion, without the parameters, the toArray () method returns an object [] array.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -