Here we intended to code a constructor method header.
We accidentally inserted a return type
void
This will actually compile okay (as an instance method)!
This means this class will not have the expected constructor
This can be a subtle bug
public
void
Rectangle(int aWidth, int aHeight)
📋
Introduction To Objects With Java (Chapter 406 - Constructors)
Chapter 406 - Constructors
Gotcha -- Avoid This Gotcha
Contents
Intro
Big Two
Gotcha
No-Arg
Overloading
Default
Using
Example
Challenge
Chapter
Top
Search
TOC