Java String with double value number

Description

Java String with double value number


//package com.demo2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        String chkValue = "12312";
        System.out.println(checkNumber(chkValue));
    }/*from  ww  w  .j a  va  2 s  .c  om*/

    public static boolean checkNumber(String chkValue) {
        try {
            Double.parseDouble(chkValue);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}



PreviousNext

Related