Write code to check if a string is A Number via Long.parseLong()
//package com.book2s; public class Main { public static void main(String[] argv) { String string = "book2s.com"; System.out.println(isANumber(string)); }/*from w w w . j a v a 2 s .co m*/ public static boolean isANumber(String string) { try { Long.parseLong(string); return true; } catch (NumberFormatException e) { return false; } } }