首页 > 代码库 > java日常开发

java日常开发

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);

    }

java日常开发