
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert Double to String and Back to Double in Java
Java lang package provides a Double class which has methods to convert Double to String and vice versa. You can convert a String to a double using the parseDouble() method and double to String using the toString() method
Example
public class StringDouble { public static void main(String args[]){ Double data1 = 2.2; String str = Double.toString(data1); System.out.println(str); Double data2 = Double.parseDouble(str); System.out.println(data2); } }
Output
2.2 2.2
Advertisements