educative.io

Line 4 of Example

What does line 4 mean?
public car () {};
Is this an empty function?


Course: Learn Java from Scratch - Free Interactive Course
Lesson: Return Parameters in Methods - Learn Java from Scratch

Hi @Karla_Alvarez

In Java public is a keyword that declares the access of a member as “public”. These members are visible to and allowed access by all other classes.

public car () {};

is a method of class car, we have initialized it as empty to show that a method could be initialized like this and not throw an error.

Thank you! It took a while for me to comprehend but now i do.