fork download
  1. class Truncate
  2. {
  3. public static void main (String[] args) throws java.lang.Exception
  4. {
  5. double x = 3.141592;
  6. int y = (int)x;
  7. System.out.println( y );
  8.  
  9. x = -3.141592;
  10. y = (int)x;
  11. System.out.println( y );
  12. }
  13. }
Success #stdin #stdout 0.1s 320576KB
stdin
Standard input is empty
stdout
3
-3