Professional Documents
Culture Documents
===========
=====================================================================================
===========
=============================================================================
- etc....
1. void method
3. pagereference method
=============================================================================
* Generic sytax:
}
* Generic Syntax Example:
===================================================
return primitivevalue/null;
return non-primitivevalue/null;
return VFPage;
Req-1) Create an Apex class. Create a void method and call this method from anonymous window.
=====================================================================================
==
public account a1 ;
public VaribleDifference(){}
a1 = new account();
________________________________________________
string s = v.strTopVar;
account a = v.ac;
account a2 = v.a1;
account a3 = v.a;
system.debug('v==>' + v);
v.methoTwo(); //calling method
=====================================================================================
===
1. STATEMENT_EXECUTE
2. HEAP_ALLOCATE
3. VARIABLE_ASSIGNMENT
4. Method Exit
5. VARIABLE_SCOPE_BEGIN
=====================================================================================
===
Req-1) Create an apex class(VaribleDifference) with void method. Create one more apex
class(SecondApexClass) with void method. Call 'VaribleDifference' class method from 'SecondApexClass'
class
=====================================================================================
==
public SecondApexClass(){
system.debug('constroctor Entry==>');
myMethod();
system.debug('myMethod Entry==>');
//str = v.strInner; // you can't get local variables from another clas
system.debug('str==>' + str);
_______________________________________________________
public account a1 ;
public VaribleDifference(){}
system.debug('methoTwo Entry==>');
a1 = new account();
_______________________________________________________
Req-2) Create an apex class(VaribleDifference2) with void method. Create one more apex
class(SecondApexClass2) with void method. Call 'VaribleDifference2' class method from the constroctor
of the same class. call 'VaribleDifference2' class from 'SecondApexClass2' class.
===============================================================================
public SecondApexClass2(){}
myMethod(st);
str = v.strTopVar;
____________________________________________________________
public account a1 ;
methoTwo(s);
strTopVar = st;
____________________________________________________________
Req-3) Create 2 apex classes. call one class from another class.
=========================================================================
myMethod(st,a);
str = v.strTopVar;
ac = v.ac;
_______________________________________________________
public account a1 ;
methoTwo(s,a);
strTopVar = st;
ac = a2;
_______________________________________________________
=========================================================================
public SecondApexClass(){
ac2 = uti.creatAccountMethod('Rama','Hyderabad','Energy');
system.debug('ac2==>' + ac2);
myMethod(st,a);
str = v.strTopVar;
ac = v.ac;
_______________________________________________________
public account a1 ;
methoTwo(s,a);
strTopVar = st;
ac = a2;
_______________________________________________________
/***
* reuse purpose
***/
ac.name = accName;
ac.site = sit;
ac.industry = ind;
return ac;
}
}
_______________________________________________________
system.debug('s==>' + s.str);
=========================================================================
Req-5) Create an apex class with different method types and constroctor
=========================================================================
public Dec13_Methods(){
str = 'VLR';
system.debug('constroctor==>' + str);
str = st;
system.debug('constroctor==>' + str);
str = 'Mohan';
acc = a;
//return type method wiht out argument && with - primitive(string) datatype
str = 'mohan';
return str;
return acc;
_______________________________________________________
de.mySecondmethod();
de.mysampelmethd();
string st = de.mystrmethod();
account a = de.myaccond();
de.mymethod('venkat',new account());
system.debug('acc =>' + de.acc);
system.debug(de.str);//'venkat
system.debug(accc);
=====================================================================================
===========
=====================================================================================
===========