You need to sign in to do that
Don't have an account?
Chitral Chadda
What is the difference between static , public and private members of a class,?
What is the difference between static , public and private members of a class,? when we invoke class from trigger? Can anyone pls explain this with the help of an example.
when we invoke class with (static , public, private member) from trigger
when we invoke class with (static , public, private member) from trigger
static
These methods can be called directly
This version of the method requires us to create a new instance
In this example, we can see that we have a private class level variable lang that we use inside of getHelloWorld. Because this variable is private, we cannot reference it outside of class level variables. We can mix and match these. For example, we can have a public class level method call a private class level method that then uses / sets both private and public variables. We can only call public variables and methos from outside the class
[1] http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
[2] http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
All Answers
static
These methods can be called directly
This version of the method requires us to create a new instance
In this example, we can see that we have a private class level variable lang that we use inside of getHelloWorld. Because this variable is private, we cannot reference it outside of class level variables. We can mix and match these. For example, we can have a public class level method call a private class level method that then uses / sets both private and public variables. We can only call public variables and methos from outside the class
[1] http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
[2] http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
to reuse the parameterized constructor.
If you are happy with my previous answer, please do me a favor and mark it as the "Best Answer" so that it can be removed from the list of un-answered questions. Additionally, if you could also delete your other post that is the same question as this so that it isn't lingering around.
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_access_modifiers.htm