Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static long parseLongWithDefault(String s, long defValue) {
        if (s == null) {
            return defValue;
        }

        try {
            return Long.parseLong(s);
        } catch (NumberFormatException e) {
            return defValue;
        }
    }

    public static Long parseLong(String s) {
        try {
            return new Long(s);
        } catch (NumberFormatException e) {
            return null;
        }
    }
}