Answer Posted / al rahid
1. Declare the Class as final (this inherently makes all
member function final)
2. Declare member variables private (not necessarily final,
because private instance variable are accessed via public
member functions only, e.g. in java.lang.String class,
variable "hash" is declared as "private int hash;" with no
final keyword).
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is module with example?
What do bitwise operators do?
Does java allow overriding static methods ?
Difference between method overloading and method overriding in java ?
extending thread class or implementing runnable interface. Which is better? : Java thread
What is a protected class in java?
What is passing value java?
Why local variables are stored in stack?
Should a main method be compulsorily declared in all java classes?
What if constructor is protected in java?
What is extension method in java?
How to obtain a performance profile of java program
What is the different types of functions?
What is meant by JVM? Is JVM platform independent or not?
Why is a constant variable important?