Every reference variable (a variable that points to any kind of object) can be said to have two types associated with it: the static type, or "compile-time type" which is the type you name when you declare the variable; and the dynamic type, or "runtime type", which is the type of the object the variable actually refers to when the program runs.
The Java compiler only knows the static type of a variable. Because you declared o as being of type Object, the compiler will only let you call methods declared in Object on it, even though you and I both know that o actually points to a ObjRefTest at runtime. You can call methods declared in ObjRefTest on o only by casting t to the proper type:
This tells the compiler that, despite the declared type of o, you know o will hold an instance of ObjRefTest when the program runs. The JVM will check this and throw a ClassCastException if you are wrong.
Please help spread the word: The word doubt is inappropriate and confusing for subject lines. I have no idea what you mean by doubt. Did you mean confusion? Even confusion, though, is too vague. The more meaningful & specific your subject, the more meaningful & specific the replies will be.
Originally posted by Adam Richards: Please help spread the word: The word doubt is inappropriate and confusing for subject lines. I have no idea what you mean by doubt. Did you mean confusion? Even confusion, though, is too vague. The more meaningful & specific your subject, the more meaningful & specific the replies will be.
If someone writes that they have just one doubt, I usually assume they have a lakh or a crore of them
For non-Indians, it's useful to know that many Indians tend to use "doubt" to mean "question".
For Indians, it's useful to know that for non-Indians the word "doubt" implies other things which you probably don't mean. It sounds like you're disagreeing with what someone told you. Or maybe you're just insecure. If you use the word "question" instead, you will probably communicate better to the rest of the world.
For everyone, additional discussion of this point would be better off in another forum such as either Meaningless Drivel or JavaRanch. Let's not further hijack a Java discussion. Start a new thread if this interests you.
"I'm not back." - Bill Harding, Twister
author and iconoclast
Originally posted by Adam Richards: I have no idea what you mean by doubt.
Not to drag this off-topic, but...
This is more or less a colloquial expression in Indian English. "I have a doubt" means "I have a question." It's not a matter of incomplete or imperfect knowledge of English; in India, it's perfectly correct and understood, just as in Britain you can ask for a fag and be understood.
Joined: Jan 30, 2000
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com