Question: Let us see an example of explicit downward casting and what can happen main method per the following requirement s : a ) declare a
Let us see an example of explicit downward casting and what can happen main method per the following requirement :
a declare a variable of type ong with a value of
b declare another variable of type int with a value of
c print both values with the appropriate labels
d now declare a variable sl of type short and cast into it
e declare another variable sl of type short and cast into it
f print both values again
Save your code in a file called Casting.java. How do you explain the results? What issues might occur if we are not careful?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
