Scanner sc = new Scanner( System.in ); int x = sc.nextInt(); if( x < 0 ) { System.out.println( "x je záporné" ); }