Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
360 views
in Technique[技术] by (71.8m points)

java - When should I use the dollar symbol ($) in a variable name?

The dollar symbol ($) is a valid character to name a variable, e.g. String superSecretFormula$;, but when we're talking about naming conventions, when should I use this symbol?

Underscore for example is mostly used to separate words, as blank spaces can't be used.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From the Java Language Specification on identifiers:

The $ character should be used only in mechanically generated source code or, rarely, to access pre-existing names on legacy systems.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...