Write code to convert a string to To Not Null value
A not null value of a string is ""
You can use the conditional operator.
//package com.book2s; public class Main { public static void main(String[] argv) { String s = "book2s.com"; System.out.println(ToNotNull(s)); }/*w ww.j a v a 2 s . c o m*/ public static String ToNotNull(String s) { return s == null ? "" : s; } }