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
Which list does not allow duplicates in java?
What happens when a thread cannot acquire a lock on an object in java programming?
Explain the difference between collection api and stream api in java8?
What is the role of the java.rmi.naming class?
What is the covariant return type?
What are examples of modifiers?
What are the disadvantages of using inner classes?
Can an object be null?
Does substring start with 0?
What are the different collection views provided by maps?
Can anonymous class have constructor?
What are thread priorities and importance of thread priorities in java?
What is a null point?
What is a 16 bit word?
What are the two ways of implementing multi-threading in java?