Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String objectToString(Object obj) {
        if (obj == null) {
            return "";
        }
        String string = "";
        if (obj instanceof String) {
            string = (String) obj;
        }
        try {
            string = String.valueOf(obj);
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (string.equals("null")) {
            string = "";
        }
        return string;
    }
}