Java Data Type Tutorial - Java Long.getLong(String nm, long val)








Syntax

Long.getLong(String nm, long val) has the following syntax.

public static Long getLong(String nm,  long val)

Example

In the following code shows how to use Long.getLong(String nm, long val) method.

/*from  ww w.  j ava2s  .c o  m*/
public class Main {

   public static void main(String[] args) {

     
     System.setProperty("Java2s.com", "12345");
     String str = "Java2s.com";
     System.out.println(Long.getLong(str, 123L));

     System.out.println(Long.getLong("java",  123L));
   }
}

The code above generates the following result.