How to typecast in java??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to typecast in java???

facing problem to typecast in java...

24th Apr 2017, 1:00 PM
Avenger
Avenger - avatar
4 Answers
+ 7
If want to convert double to int double a=3.14; int b=(int)a; System.out.println(b); output : 3 In general keep that datatype to which you want to convert in the brackets and place the variable beside it. and store it in the new specified datatype variable (Target-type)variable name;
24th Apr 2017, 1:13 PM
Manideep
Manideep - avatar
+ 4
anytime :)
24th Apr 2017, 1:18 PM
Manideep
Manideep - avatar
+ 3
thanks shikamaru
24th Apr 2017, 1:18 PM
Avenger
Avenger - avatar
+ 2
is assigning value of one type of variable to another
24th Apr 2017, 1:03 PM
Avenger
Avenger - avatar