From da84162282b411367522daf3edecacd8ea63869b Mon Sep 17 00:00:00 2001 From: howieandersen <36008713+howieandersen@users.noreply.github.com> Date: Fri, 15 Mar 2019 08:03:22 +0100 Subject: [PATCH] added basic information about default constructors in the index file for methods (#29797) --- guide/english/java/methods/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guide/english/java/methods/index.md b/guide/english/java/methods/index.md index 802b3aec9e..5d38d72bfc 100644 --- a/guide/english/java/methods/index.md +++ b/guide/english/java/methods/index.md @@ -106,3 +106,5 @@ public class Car { ``` The `Car` class and the `Car(String model, int numberOfWheels)` method have to have the same name in order for java to know that it is the constructor. Now anytime you instantiate a new `Car` instance with the `new` keyword you will need to call this constructor and pass in the needed data. + +When we don't specifically define a constructor for a class, java creates a default constructor. This is a non-parameterized constructor, so it does not contain or accept any arguments. The default constructor calls the super class constructor and initializes all necessary instance variables