0

Is there an equivalent of the C# property call in java?

protected int foo2{ get; set; }

instead of doing this all the time:

private int foo2;
public void setfoo2 (int value) {foo2 = value;}
public int  getfoo2 () {return foo2;}
genxgeek
  • 13,109
  • 38
  • 135
  • 217

1 Answers1

1

nope.

they are different languages. different ways of doing things. BTW c# too does the same thing in the background. what c# gives is what we call syntactic sugar. it gives a shorthand writing.

inquisitive
  • 3,549
  • 2
  • 21
  • 47