Java examples for Language Basics:long
Convert String to Long Type
public class Main { public static void main(String[] args) { //1. Construct Long using constructor. Long lObj1 = new Long("100"); System.out.println(lObj1);//from w ww . j av a 2 s .co m //2. Use valueOf method of Long class. This method is static. String str = "100"; Long lObj2 = Long.valueOf(str); System.out.println(lObj2); } }
Suggest JVM to Run Object Finalization Example