1)when we use refference of any object why toString()call automatically? 2)What is inlining for final method.
posted 14 years ago
1) All objects inherit from class Object. It has a toString() method. 2)If a method is final, then it can not be overriden. That means that at compile time the compiler KNOWS what is going to happen and can therefore do some stuff to make it more efficient. One of the things that it can do if it KNOWS what the method will return - always, then it can replace the call to the method with just the value that that method will return - also known as "inlining" (meaning that you don't have to go off to the method to find the answer).
"JavaRanch, where the deer and the Certified play" - David O'Meara