是判断arr[1]是不是等于字符串null,“null”是字符串,
按你的业务,要求判断arr[1]是不是空元素(null)
这两个不一样
mport java.util.Scannerpublic class Exos4{ public static void main(String[] args){Scanner s = new Scanner(System.in) System.out.println("请输入一个数:") double x = s.nextDouble() double y = 0.0 if(x>0){y = x+3 }else{y = x*x-1 }System.out.println("x=" + x + " " + "y=" + y) try{System.in.read() }catch(Exception e){e.printStackTrace() }} }