import java.io.*; import java.lang.*; public class StringToLong{ public static void main(String[] args) throws IOException{ BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the any string number:"); String str = read.readLine(); try{ long l = Long.parseLong(str); System.out.println("long:= " + l); } catch (Exception e){ System.out.println("Exception: " + e.getMessage()); } } }