-5

Is it correct to assume that Property in Java it is simple getter and setter?

Alex
  • 2,091
  • 6
  • 31
  • 49

2 Answers2

3

As @Hovercraft Full of Eels mentioned, standard Java Beans appear to have properties (provided by getter and setter methods), but Properties do not exist in Java as they exist in C# (see question No Properties in Java)

Community
  • 1
  • 1
Ch4ni
  • 292
  • 1
  • 10
0

In your example there are just a field named secret and two methods named property.

You can have two methods with the same name in java because this language supports polymorphism.

There is an important condition, the two methods can have the same name but not the same signature, parameters and/or return type should be differents.

You can find more information about polymorphism in java here : polymorphism in java

Tyoras
  • 26
  • 1
  • 4
  • My question is not about polymorphism. It's about properties in Java as part of language. – Alex Nov 04 '14 at 18:39
  • Ok, so the best answer is eurythmia's one : Properties do not exist in Java as they exist in C# – Tyoras Nov 05 '14 at 11:05