performance - when it is better to use constructor for android application -
I'm new to Android development. Still, I'm looking at the constructor in many codes. I do more research on Google about it. Answer is now the basic idea about it. I want to be a good signer, so it is important for me to know that when using the constructor for any android application development It would be better to do So if someone has a good suggestion for me whether I should use the constructor or not.
The constructor is used to be able to set dynamic values for objects on its construction. Or to ensure that the needs of the object are started at construction time. For example:
class item {Private int a; Item (at value) {this.a = value; } Public int getValue () {// You can operate on returns; }} You can create an object using the above code and start the variable at the same time. Or there are other ways to do this:
class item {Private int A; Public Zero Set Value (Int Value) {this.a = value; } Public int getValue () {// You can operate on returns; }} Now, using this code, you must first create an object, start the variable using the setValue method, and then get getValue.
Therefore it is very clever to select the constructor for better code. For more help go through this
Hope it helps .. !!
Comments
Post a Comment