public class test3
{
public static void main(String[] args) {
//question 1
Object o = true ? new Integer(1) : new String("2");
System.out.println(o);
//question 2
Integer i = new Integer(1);
if (i.equals(1))
i = null;
Double d = new Double(2.0);
Object o = true ? i : null;
System.out.println(o);
}
}
public static void main( String[] args )
{
func(new String[]{null});
func((String)null);
func(null);
func(null,null);
}
public static void func(String...args) {
System.out.println("arg length = "+args.length);
}
时间: 2024-10-10 16:24:53