We would like to know how to convert Java String to Long.
/* ww w . java 2s. com*/ public class Main { public static void main(String[] args) { Long lObj1 = new Long("100"); System.out.println(lObj1); String str = "100"; Long lObj2 = Long.valueOf(str); System.out.println(lObj2); } }
The code above generates the following result.