Java tutorial
//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; } }