Stop Using new Everywhere At some point, every codebase reaches this stage if (type.equals("CAR")) { return new Car(); } else if (type.equals("BIKE")) { return new Bike(); } else if (type.equals("TRUCK")) { return new Truck(); } It works...

Markdown supported · ⌘↵ to post
No responses yet.