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

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -