Class and Conductor Variable

What is major difference in assigning a variable in class and assigning a variable in constructor?

Questions by sheemanahid

Showing Answers 1 - 3 of 3 Answers

A Constructor Class is a class that is used to create a new class using the "new" keyword. Any variable declared under this constructor class will be a "Class Variable" meaning all object instances created by using this class shall have the variable as a "Field" and the value it holds will be of the "type" of class-variable.

Any variable declared outside of the constructor and within its super class should always be associated with a keyword that describes the type of variable. Example Public, Private, Protected etc. When a new object instance is created using the super class or any class outside of constructor need not necessarily define a value for the variable.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions