top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to know if an explicit object casting is needed in Java?

0 votes
549 views
How to know if an explicit object casting is needed in Java?
posted Feb 27, 2017 by Karthick.c

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
 
Best answer

If we assign a superclass object to a variable of a subclass’s data type, we need to do explicit casting.

For example:
Object a;
Customer b;
b = (Customer) a;

I hope I understood question correctly...

answer Feb 27, 2017 by Salil Agrawal
Similar Questions
+2 votes

Java does not have sizeof operator now my question is How to find out how much memory is used by an object in Java?

+1 vote

Java is a purely Object Oriented programming language or not.......?
If Not
Then write a program without class & objects.......

0 votes

We define copy constructor using
A(const A & obj)

Why reference (&) is needed?
Why we are not allowed to use.

A(const A obj)
...