x? (x>=0)
y=
-x? (x<0)
参考答案
答案:import java.io.*;public class testa{ public static void main(String[] args) throws IOException{float? x,y;InputStreamReader reader=new InputStreamReader(System.in);BufferedReader input=new BufferedReader(reader);System.out.println("请输入x:");String temp=input.readLine();x = Float.parseFloat(temp);if(x>=0){y=x;}else{y=-x;}System.out.println("y="+y);}}