Skip to main content
rohit kumar 提问于 #Apex
1

public class Employee1 {

2

public Employee1()

3

!

Integer age;

4

{

5

age ='50';

6

}

7

public integer getAge()

8

{

9

return age;

10

}

11

public string getName()

12

{

13

return'xyz';

14

15

}

16

}

 
1 个回答
  1. 2015年7月8日 07:00
    Hello Amit,

    Here is correct way to your code. You where assigning the age in quotes it will take it as string in palce of integer .For integer value assign  it without quote.

    public class Employee1 {

    Integer age;

    public Employee1()

    {

    age =50;

    }

    public integer getAge()

    {

    return age;

    }

    public string getName()

    {

    return'xyz';

    }

    }

     
0/9000