casting types identification – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2016-02B #JAVA#4223    siteicon   siteicon  

Problem Statement - casting types identification

What are the types of casting shown by the following examples:
(i) char c = (char)120;
(ii) int x = ‘t’;

Solution

TC++ #4223

(i) char c = (char)120;
This is a case of Explicit casting as an integer value 120 is being casted to a a character data type.

(ii) int x = ‘t’;
This is case of Implicit Casting as without applying any cast type a character is being converted to an integer.


Share

sunmitra| Created: 31-Mar-2018 | Updated: 16-Apr-2019|ICSE2016






Back