Skip to content

Conversation

nitinvishwari
Copy link

@nitinvishwari nitinvishwari commented Jul 25, 2025

It's not a good idea to use synchronized in the getInstance. There is a need only for the first time and not for further reads. So I am commiting a better alternative.

@nitinvishwari nitinvishwari changed the title Feature/car rental system Car rental system small change Jul 25, 2025

public class CarRentalSystem {
private static CarRentalSystem instance;
private static CarRentalSystem instance = new CarRentalSystem();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants