Does java have something similar to C# properties? [duplicate]

No, Java does not have the equivalence. It only has accessor and mutator methods, fancy names for getter and setter methods. For example:

public class User {
    private String name;

    public String getName() { return this.name; }
    public void setName(String name) { this.name = name; }
}

Leave a Comment