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
How do you control extraneous variables?
Why are the objects immutable in java?
What does sprintf mean?
What are the types of methods in java?
what is the major difference between linkedlist and arraylist in java?
What is protected access modifier?
Explain different ways of creating a thread?
What is anagram in java?
What is function declaration?
What is the difference between preemptive scheduling and time slicing in java programming?
Why is the main method declared static?
How do I get 64 bit java?
Why singleton is not thread safe?
Explain the difference between abstract classes and interfaces in java?
What is the final field modifier?