Learn Java Coding

Everything You Have To Know About Java

Constructor

a constructor is a special method. It is used to give objects characteristics ASAP.

 

examplE

CLICK HERE

Theory

SYNTAX: modifier + className + () + { + }

TWO TYPES:

constructor is a special method, therefore you can choose between non-parametrised and parametrised constructors as you did with methods.

  1. Constructor with parameter
  2. Constructor without parameter

FACTS

 

Next Post

Previous Post

© 2021 Learn Java Coding