You need to sign in to do that
Don't have an account?
Ritika Singh
Custom controller and VFP
A developer creates a customer controller and custom Visualforce page by using the following code block:
public class myController { public String myString;
public String getMyString() { return 'getMyString';
}
public String getStringMethod1() { return myString;
}
public String getStringMethod2() { if (myString == null)
myString = 'Method2'; return myString;
}
}
<apex:page controller="myController">
{!myString}, {!StringMethod1}, {!StringMethod2}, {!myString}
</apex:page>
What does the user see when accessing the custom page?
a. getMysString, , Method2, getMyString
b. , , Method2, getMyString
c. , , Method2,
d. getMyString, , ,
public class myController { public String myString;
public String getMyString() { return 'getMyString';
}
public String getStringMethod1() { return myString;
}
public String getStringMethod2() { if (myString == null)
myString = 'Method2'; return myString;
}
}
<apex:page controller="myController">
{!myString}, {!StringMethod1}, {!StringMethod2}, {!myString}
</apex:page>
What does the user see when accessing the custom page?
a. getMysString, , Method2, getMyString
b. , , Method2, getMyString
c. , , Method2,
d. getMyString, , ,
The answer is :
a. getMyString, , Method2, getMyString
As first when you called
{!myString} : getMyString() is called and value is 'getMyString'.
{!StringMethod1} : it calls getStringMethod1() and value is blank or ''.
{!StringMethod2} : it calls getStringMethod2() and value is 'Method2'.
{!myString} : getMyString() is called and value is 'getMyString'.
Do let me know if it helps you and close your query by marking it as solved.
Regards,
Santosh
All Answers
The answer is :
a. getMyString, , Method2, getMyString
As first when you called
{!myString} : getMyString() is called and value is 'getMyString'.
{!StringMethod1} : it calls getStringMethod1() and value is blank or ''.
{!StringMethod2} : it calls getStringMethod2() and value is 'Method2'.
{!myString} : getMyString() is called and value is 'getMyString'.
Do let me know if it helps you and close your query by marking it as solved.
Regards,
Santosh
Thanks for the response. It was helpful.