Java - Write code to get String from Object, handle null value with conditional operator

Requirements

Write code to get String from Object, handle null value with conditional operator

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        Object value = "book2s.com";
        System.out.println(getString(value));
    }//from   w w w .j  a va  2 s. c  o  m

    /**
     * 
     */
    public static String getString(Object value) {
        return value == null ? null : value.toString();
    }
}

Related Exercise