[4014] in java-interest
final keyword usage
daemon@ATHENA.MIT.EDU (R.Volkmann)
Thu Dec 7 13:19:59 1995
Date: Thu, 7 Dec 95 09:10:25 -0600
From: "R.Volkmann" <m224873@ws1768.mdc.com>
To: java-interest@java.sun.com
Reply-To: "R. Mark Volkmann"<m224873@svmstr01.mdc.com>
A few people on the list have told me that in Java "final" takes the place
"const" in C++. Which of the following are valid uses of "final"?
- used to create a constant
final float pi = 3.1415928;
- used to declare that a function argument will not be modified
class City {
public float milesTo(final City destinationCity) { ... }
...
}
- used to prevent callers from changing an object returned from a function
class Foo {
public final String data() { return data_; }
protected String data_;
}
|------------------------------------------------------------|
| R. Mark Volkmann - Principal Specialist Programmer/Analyst |
| McDonnell Douglas Aerospace, St. Louis, Missouri, USA |
| email m224873@svmstr01.mdc.com, voice (314)232-0498 |
|------------------------------------------------------------|
"As the evening sky faded from a salmon color to a sort of flint gray,
I thought back to the salmon I caught that morning, and how gray he was,
and how I named him Flint." from Deep Thoughts by Jack Handy
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com