WAP to typecast the following: String to Double

1 year ago
OOP Java

Compile code:

public class StringToDouble{
  
    // main method
    public static void main(String args[])
    {
  
        // create a String
        String str = "2033.12244";
  
        // convert into Double
        double str1 = Double.valueOf(str);
  
        // print String as Double
        System.out.println(str1);
    }
}

 

Output:

0
Dipti KC
Jan 8, 2023
More related questions

Questions Bank

View all Questions