Class Variables-Local Variable-Method Parameters

Class Variables

  • A Variable which is declared inside class but not in it method is called Class Variable.
  • Also called as member Variables.
  • In the previous example, model is class variable
  • It can be initialized
  • The variable declared inside a class, can be accessed to all the code inside a class.
Local Variables
  • Variables declared inside method of a class
  • They can be used within the method

Class Parameters/Arguments

  • These are arguments passed to Classes
  • The scope of Class Parameter is just like Class variable entire the class

Method Parameters/Arguments

  • These are arguments passed to Methods which are inside classes
  • The scope of Method Parameter is for that method
  • They cannot be initialized