Why doesn't Java have automatic properties like C#?

Sergio Tapia picture Sergio Tapia · Aug 7, 2010 · Viewed 16.1k times · Source

C# has automatic properties which greatly simplify your code:

public string Name { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }

Whereas Java has you write this much code:

private String name;
private String middleName;
private String LastName;

public String Name(){
   return this.name;
}

etc..

Is there a particular reason Java hasn't implemented something like this?

Answer

Noon Silk picture Noon Silk · Aug 7, 2010

Yep, because it doesn't have it. As the saying goes, all features start out unimplemented.