The moose likes Beginning Java and the fly likes some questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "some questions" Watch "some questions" New topic

some questions

atif imran

Joined: Mar 21, 2002
Posts: 2
1)when we use refference of any object why
toString()call automatically?
2)What is inlining for final method.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
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
I agree. Here's the link:
subject: some questions
It's not a secret anymore!