You can use Double.parseDouble() to convert a String to a double:

String text = "12.34"; // example String
double value = Double.parseDouble(text);

For your case it looks like you want:

double total = Double.parseDouble(jlbTotal.getText());
double price = Double.parseDouble(jlbPrice.getText());
Answer from WhiteFang34 on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › java › double-parsedouble-method-in-java-with-examples
Double parseDouble() method in Java with examples - GeeksforGeeks
July 11, 2025 - // Java Code to implement // parseDouble() method of Double class class GFG { // Driver method public static void main(String[] args) { try { String str = ""; // returns the double value // represented by the string argument double val = Double.pa...
🌐
Tutorialspoint
tutorialspoint.com › home › java/lang › java double parsedouble method
Java Double parseDouble Method
September 1, 2008 - Following is the declaration for java.lang.Double.parseDouble() method · public static double parseDouble(String s) throws NumberFormatException ... This method returns the double value represented by the string argument.
🌐
LabEx
labex.io › tutorials › java-java-double-parsedouble-method-117627
double.parsedouble in Java | LabEx
This will execute the Java program and output the following: Double value of 8.97 is 8.97 Error: For input string: "not a number" is not a valid double Enter a number: 9.56 Double value of 9.56 is 9.56 Error: null - It's not possible to convert ...
🌐
Stack Overflow
stackoverflow.com › questions › 72652140 › i-want-to-parse-a-string-and-get-a-double-value-java
I want to parse a string and get a double value (java) - Stack Overflow
String myString = "65.2 hello"; double value = Double.parseDouble(myString.replaceAll("[^(-?\\d+(\\.\\d+)?)]", "").trim()); should be suffice. But, if there is more than one numerical value within the string then you would need to change it ...
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Double.html
Double (Java Platform SE 8 )
October 20, 2025 - Constructs a newly allocated Double object that represents the floating-point value of type double represented by the string. The string is converted to a double value as if by the valueOf method. ... NumberFormatException - if the string does not contain a parsable number.
🌐
Tabnine
tabnine.com › home page › code › java › java.lang.double
Java Examples & Tutorials of Double.parseDouble (java.lang) | Tabnine
@Override protected void checkParameters(String attribute, String value) { super.checkParameters(attribute, value); if (PARAM_QUALITY_FACTOR.equals(attribute)) { value = unquote(value); double d = Double.parseDouble(value); Assert.isTrue(d >= ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-convert-string-to-double
Java Convert String to double | DigitalOcean
August 3, 2022 - String str = "98.7"; double d = new Double(str).doubleValue(); //constructor deprecated in java 9 System.out.println(d); //98.7 · This is useful to parse formatted string to double. For example, if String is “1,11,111.23d” then we can use DecimalFormat to parse this string to double as:
Find elsewhere
🌐
Javatpoint
javatpoint.com › java-double-parsedouble-method
Java Double parseDouble() Method - Javatpoint
The parseDouble method of Java Double class returns a new double value that is initialized to the value corresponding to defined String.
🌐
BeginnersBook
beginnersbook.com › 2013 › 12 › how-to-convert-string-to-double-in-java
Java Convert String to Double examples
The value of variable dnum of double type would be 122.202 after conversion. Lets see the complete example of the conversion using parseDouble(String) method. public class JavaExample{ public static void main(String args[]){ String str = "122.202"; /* Convert String to double using * ...
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › lang › Double.html
Double (Java SE 17 & JDK 17)
January 20, 2026 - ... Deprecated, for removal: This API element is subject to removal in a future version. It is rarely appropriate to use this constructor. Use parseDouble(String) to convert a string to a double primitive, or use valueOf(String) to convert a string to a Double object.
🌐
Coderanch
coderanch.com › t › 595201 › java › parse-Double-parseDouble
What is parse? (Double.parseDouble();)? (Beginning Java forum at Coderanch)
This is an example he gave. I pasted the whole code just in case. public static void main(String[] args) { Scanner keyboard; keyboard = new Scanner(System.in); boolean userContinue = true; String userInput; int count = 0; double sum = 0; double average = 0; while (userContinue) { System.out.println("Enter a number or Q to quit"); userInput = keyboard.next(); if (userInput.toLowerCase().equals("q")) { userContinue = false; } else { sum += Double.parseDouble(userInput); count += 1; } } // end of the while average = sum / count; System.out.printf("The average is %f\n", average); } // end of main Thank you!!
🌐
IncludeHelp
includehelp.com › java › double-class-parsedouble-method-with-example.aspx
Java - Double Class parseDouble() Method
// Java program to demonstrate ... args) { // Variables initialization String str1 = "100"; String str2 = "6.7"; // Object initialization Double d1 = new Double(str2); // It convert string into double by calling parseDouble() method // and store the result in another variable ...
🌐
Vultr Docs
docs.vultr.com › java › examples › convert-string-variables-to-double
Java Program to convert string variables to double | Vultr Docs
December 20, 2024 - Use DecimalFormat to handle these cases and parse strings into doubles according to locale-specific rules. ... import java.text.DecimalFormat; import java.text.ParseException; String euroNumberStr = "1.234,56"; DecimalFormat format = new DecimalFormat("#,##0.00"); try { double number = format....
🌐
GeeksforGeeks
geeksforgeeks.org › java › convert-string-to-double-in-java
Convert String to Double in Java - GeeksforGeeks
July 11, 2025 - The parseDouble() method of the ... as done by the valueOf method of class Double. ... Example: Java Program to Convert String to Double Using parseDouble() Method....
🌐
Baeldung
baeldung.com › home › java › java string › convert string to double in java
Convert String to Double in Java | Baeldung
January 8, 2024 - Since Java 5, this boxed Double is converted by the compiler to a primitive double where needed. In general, we should favor Double.parseDouble since it does not require the compiler to perform auto-unboxing. When a String representing a double has a more complex format, we can use a DecimalFormat. For example, we can convert a decimal-based currency value without removing non-numeric symbols:
🌐
Programiz
programiz.com › java-programming › examples › string-to-double-conversion
Java Program to convert string variables to double
For example, class Main { public static void main(String[] args) { // create a string variable String str1 = "Programiz"; // convert string to double // using parseDouble() double num1 = Double.parseDouble(str1); // print double values System.out.println(num1); // throws NumberFormatException } }
🌐
Java Tutorial HQ
javatutorialhq.com › java tutorial › java.lang › double › parsedouble(string s) method example
Java Double parseDouble(String s) method example
September 30, 2019 - This method returns the primitive double value of the string method input. To make this example sensible we will calculate the tax incurred from the user input. package com.javatutorialhq.java.examples; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; /* * This example source code demonstrates the use of static method * parseDouble(String str) of Double class */ public class DoubleParseDoublefString { public static void main(String[] args) { /* * Example on how to calculate the tax incurred * given the amount and tax percent
🌐
Studytonight
studytonight.com › java-wrapper-class › java-double-parsedouble-method
Java Double parseDouble() Method - Studytonight
import java.lang.Double; public class StudyTonight { public static void main(String[] args) { String s1 = "21.62"; String s2 = "-73.056"; double n1 = Double.parseDouble(s1); //converts the passed string into its corresponding double value double ...