Posts

Showing posts with the label Core Java

Quick Refresh : Core Java : Constructor, instanceOf, Downcasting, Access Modifiers, abstract, final, static, this, instance initializer block

Image
Quick Refresh : Core Java : Constructor, instanceOf, Downcasting, Access Modifiers, abstract, final, static, this, instance initializer block A field is a class member. A static field is sometimes called a class variable. A non-static field is sometimes called an instance variable. A variable declaration that is immediately contained by a block such as a method body is called a local variable. The access modifiers, private, protected and public, can be applied to a field.  Constructor:  Constructor is a special type of method that is used to initialize the state of an object. Constructor is invoked at the time of object creation. It constructs the values i.e. data for the object that is why it is known as constructor. Types of constructors Default Constructor - Default constructor provides the default values to the object. Parameterized Constructor - A constructor that have parameter is known as parameterized constructor. Parameterized constructor is ...