Java – Convert String into double

String can be converted into double in java by parseDouble() method. Type casting is a method to change string to double.

Example of converting string to double

public class StringToDoubleConvert {

    public static void main(String[] args) {

        String string_to_double="1234.8973737373";

        double db1=Double.parseDouble(string_to_double);

        System.out.println("Type cast string to double :"+db1);
    }
}

Output

Type cast string to double :1234.8973737373

Tags:

Bookmark  

 

Leave a Reply

Security Code:

 

  Random Post