You need to sign in to do that
Don't have an account?
shaqib ahmad
unable to call class/methods
public class Dog
{
private String name;
private Integer age;
public void setName(String n)
{
name=n;
}
public void SetAge(integer j)
{
age=j;
}
public String getName()
{
return name;
}
public Integer getAge()
{
return age;
}
public void bark ()
{
System.debug('');
}
}
///
I am using this apex code
Dog d1=new Dog();
d1.setName=('frido');
d1.setAge=12;
System.debug('the name is '+d1.getName() +'' +d1.getAge());
{
private String name;
private Integer age;
public void setName(String n)
{
name=n;
}
public void SetAge(integer j)
{
age=j;
}
public String getName()
{
return name;
}
public Integer getAge()
{
return age;
}
public void bark ()
{
System.debug('');
}
}
///
I am using this apex code
Dog d1=new Dog();
d1.setName=('frido');
d1.setAge=12;
System.debug('the name is '+d1.getName() +'' +d1.getAge());
Please try using the below code:
public class Dog
{
private String name;
private Integer age;
public void setName(String n)
{
this.name=n;
}
public void SetAge(integer j)
{
this.age=j;
}
public String getName()
{
return name;
}
public Integer getAge()
{
return age;
}
public void bark ()
{
System.debug('Bow Bow!!!!');
}
}
---------------------------------------
Dog d1=new Dog();
System.debug(d1);
d1.setName('frido');
d1.setAge(12);
System.debug('the name is '+d1.getName() +'' +d1.getAge());
Hope this helps and please close the thread marking the best answer so as to keep the commmunity clean and so that it is useful for others in future.
Regards,
Anutej
All Answers
Please try using the below code:
public class Dog
{
private String name;
private Integer age;
public void setName(String n)
{
this.name=n;
}
public void SetAge(integer j)
{
this.age=j;
}
public String getName()
{
return name;
}
public Integer getAge()
{
return age;
}
public void bark ()
{
System.debug('Bow Bow!!!!');
}
}
---------------------------------------
Dog d1=new Dog();
System.debug(d1);
d1.setName('frido');
d1.setAge(12);
System.debug('the name is '+d1.getName() +'' +d1.getAge());
Hope this helps and please close the thread marking the best answer so as to keep the commmunity clean and so that it is useful for others in future.
Regards,
Anutej
Anutej