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


Please Help Members By Posting Answers For Below Questions

What is function and its uses?

810


What is the Concept of Encapsulation in OOPS

761


What is meant by 'bit masking' in java?

890


What is the use of predicate in java 8?

710


What are thread groups?

777


Is it possible to compare various strings with the help of == operator?

775


What is classname class in java?

773


Why does java have two ways to create child threads? Which way is better?

804


What is the latest version of java?

817


What is preparedstatement in java?

801


What is java and why do we need it? Explain

817


Can java arraylist hold different types?

748


Is java written in c?

738


What is a lightweight component?

818


What function extracts specified characters from a string?

775