Challenge: Type Casting
Test yourself and implement what you have learned so far in this challenge.
We'll cover the following
Problem Statement
In this challenge, your task is to convert the data type of an already existing variable using type casting. You are provided with a variable oldType
of type Float
which needs to be type cast to Double
.
Input
The input is the variable oldType
.
oldType
has already been declared for you.
Output
The output will be the value assigned to newType
.
Sample Input
45F
Sample Output
45D
Test Yourself
Write your code in the given area. Try the exercise by yourself first, but if you get stuck, the solution has been provided. Good luck!
// Rewrite newTypeval newType: String = "temp"
Let’s go over the solution review in the next lesson.