what is object type casting? give some example with related?
Answer Posted / aaratim
Object type casting is converting a object type into another
type. For example
Iterator ite = emplist.iterator();
while(ite.hasNext()){
Employee empObj = (Employee)ite.next();
}
Here ite.next returns instance of type Object, we need to
convert it to type Employee so this is called type casting.
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
Can we declare the static variables and methods in an abstract class?
What happens if we override only equals?
Why does java not support operator overloading?
What is a memory leak in java?
Can a final method be overloaded?
When is finally block not called?
What is the indent key?
What is size of int in java?
Write a function to print Fibonacci series and Tribonacci series?
Define how objects are stored in java?
Can you call a method in a method?
How many inner classes can a class have?
Is alive and join method in java?
Which is better ascii or unicode?
What is finalize() function in java?