function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
krishna reddy Singampallikrishna reddy Singampalli 

illegal assignment from list to list (error like this)

public class Soql_Example {
    public List<Account> accounts {set;get;}
    
    public Soql_Example(){
        accounts=[select name,phone,rating,industry from Account];
        
    }
 
Suraj Tripathi 47Suraj Tripathi 47
Hi,

There is not any error in your code. Please paste full code.

Please mark it as Best Answer if it helps you.

Thanks & Regards
Suraj Tripathi
CharuDuttCharuDutt
HII Krishna

Just Refresh The Dev Console Window And Try To Save It Again

Please Mark It As Best Answer If It Helps
Thank You!
ravi soniravi soni
hi krishna,
I ran same query but i didn't find any error.
excute following way in your anonymous window and check output again. I'm sure this time you will not face any error.
Soql_Example  oSoql_Example = new Soql_Example ();

let me know if it helps you by marking it as best answer.
Thank you.

 
krishna reddy Singampallikrishna reddy Singampalli
it shows error  like this boss
zoom it and see once                  User-added image 
SwethaSwetha (Salesforce Developers) 
HI Krishna,
Strangely, I can't reproduce the error too.(Notice that console doesn't show any problems)
User-added image
I'd recommend that you try this code in the new Workspace(Click path: Dev console> Workspace>new Workspace). Or try with workbench.

Related: https://developer.salesforce.com/forums/?id=906F0000000g1y6IAA

If this information helps, please mark the answer as best. Thank you