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
deva mdeva m 

Error: Compile Error: Variable does not exist: Name at line 7 column 9

Hi ,
Help out with this problem

public class Acc1
{
 Account acc=new Account();
    public void accmethod()
    {
       
        acc.Name='deva';
     }
}
Nagarjuna ReddyNagarjuna Reddy
Hi Deva!!

Try this.

public class Acc1
{

    public void accmethod()
    {
          Account acc=new Account();
          acc.Name='deva';
     }
}

Cheers!
Nag Arjun
gautam_singhgautam_singh
Hi, 

Try this or the above as mentioned. 

public class Acc1{

    //constructor - space allocation for new account.
    public Acc1(){
        Account acc=new Account();
    }
 
    //when called it populates the acc name as 'deva' 
    public void accmethod(){
       
        acc.Name='deva';
        
     }
}


Important :

If you have received the answer which you are looking for, Please mark it as a Solution, this will help others to find the resolution of problem with ease. 
More, you can make the Developers of the Community smile by appreciating the answer with the "Like" Button. We would love to help you again. 

Thank You
Gautam Singh 
Blog - http://singhgautam02.blogspot.in/
Me   - about.me/singhgautam