1

Before forming a class in Java or other programming languages that support OOP, should I use underscore (_) in each (local or private) field declaration.

More precisely:

private String _customername;

Is this a correct declaration?

Hakan
  • 113
  • 2
    It depends on the language you use and on local conventions. For example, in C++ a leading underscore is in many cases reserved for use by the compiler/standard library, while in other languages it is used to designate a private member. – Bart van Ingen Schenau Feb 04 '14 at 09:14
  • 1
  • This is unrelated to OOP. 2) If this is legal depends on the language. In Java, C# it's legal. In some other languages it might not be. 3) If it's a good idea depends on language conventions and personal preference.
  • – CodesInChaos Feb 04 '14 at 10:05
  • Hmm.. normally before posting it, I checked the forum. I have overlooked the relating topic, though. Thanks all! – Hakan Feb 04 '14 at 13:48