Skip to content

Instantly share code, notes, and snippets.

@mailtoharshit
Created August 22, 2012 00:43
Show Gist options
  • Save mailtoharshit/3420953 to your computer and use it in GitHub Desktop.
Save mailtoharshit/3420953 to your computer and use it in GitHub Desktop.
Property
private Integer cost;
public Integer getcost() { return cost; }
public void setcost(Integer cost) { this.cost=cost; }
// Variable as Property
public Integer cost { get { return cost; } set { this.cost= cost;}}
//Variable as Automatic Property
public Integer cost { get; set; }
//read-only and write - only Property
public Integer readOnly { get; private set;}
public Integer wrtieOnly { private get; set;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment