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
TheLearnerTheLearner 

regarding my code

Hi Experts,

Im salesforce admin, im learning development also , just im practising java code in salesforce, while trying i developed this code ,i dont know whats wrong is there in this code,please help me out. really im nothing in coding. Thanks in adavance.

public class learn
{
 int n;
 int result;  
public void set(int x)
  {
  n=x;
    }
      public void display()
      {
         
         for(int i=1;i<10;i++)
            {
               result=n*i;
                system.debug(result);
                
                }
                }
                }
                
          public class mul
                  { 
         

                learn emp= new learn();
                emp.set(2);
              emp.display();
                
                 }            

               
Best Answer chosen by TheLearner

All Answers

Ganesh HembramGanesh Hembram
Hi,
First of all your variable declaration is not correct. You have to declare your variable as Integer n not int n.
TheLearnerTheLearner
Hi Ganesh,

Thanks for the reply yes i got it whr i did wrong, see this is my latest code which is error free, please try to give me some docs so that i can improve my development skills.

public class learn
{
 integer n;
 integer result;  
public void set(integer x)
  {
  n=x;
    }
      public void display()
      {
         
         for(integer i=1;i<10;i++)
            {
               result=n*i;
                system.debug(result);
                
                }
                }
           public void temp()
           
{                       
learn emp= new learn();
                emp.set(2);
              emp.display();
                } 
                }
Ganesh HembramGanesh Hembram
The below link is for Apex Developer
https://www.salesforce.com/us/developer/docs/apexcode/
TheLearnerTheLearner
hi,
please provide me visualforce pages with combination of apex code so that , beginers like me can learn please