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
Vijay@sfdcVijay@sfdc 

how to accesss var2 inside testmethod

Hello All,

 
class Sample 
{
     string var1

      public void testmethod()
   {
         string var2;
   }
}

Sample  obj = new Sample ();

 obj.testmethod();
  obj.var1= 1;

how to Access give data to var2 ?
 obj.var2= 'Test data var2';