kiruthigha rajan wrote:hello i am new to this forum.can anyone please explain the elucidated stuff given below with an example
A reference variable can be of only one type, and once declared, that type
can never be changed (although the object it references can change).
kiruthigha rajan wrote:
A reference is a variable, so it can be reassigned to other objects, (unless the
reference is declared final).
kiruthigha rajan wrote:
A reference variable's type determines the methods that can be invoked on
the object the variable is referencing.
kiruthigha rajan wrote:
A reference variable can refer to any object of the same type as the declared
reference, or—this is the big one—it can refer to any subtype of the
declared type!
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla wrote:and Welcome to JavaRanch!
You need to go through some tutorials, work out some code to understand the concepts. Just trying to understand what they mean from the language point of view, you can get confused.
The best way to learn a programming language is to WRITE CODE.
John Jai wrote:Question is if you have a reference type of the Animatable interface which methods can you call with that variable.
| Consider Paul's rocket mass heater. |