Answer Posted / kanchan
To make a class immutable,
1. Don't provide any methods that modify the object.
2. Ensure that no methods may be overridden. Mark the class
as final. Make all fields final and private.
| Is This Answer Correct ? | 63 Yes | 1 No |
Post New Answer View All Answers
Which collection does not allow duplicates in java?
What is the generic function?
What is hashing in java?
what state does a thread enter when it terminates its processing? : Java thread
Explain the difference between the public, private, final, protected, and default modifiers?
What are the rules for naming an array?
How do you join strings in java?
Which programming language is best in future?
Is java call by value?
how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion... ANS:--- >executeupdate method is having boolean return type, if anything goes wrong in data insertion or data updation, it would return false. otherwise, if it successfully inserts data into the database, it would return true NOW HOW TO I CHECK IN MY DURING EXECUTION WHETHER IT RETURNS TRUE OR FALSE... WELL IT WILL DISPLAY ANY MESSAGE OR NOT
How do you use compareto method?
How can we make string upper case or lower case?
Can java inner class be static?
How many types of classes are there in java?
What is the difference between class & structure?