fork download
  1. /* package whatever; // don't place package name! */
  2. import java.util.Scanner;
  3.  
  4. /* The class name doesn't have to be Main, as long as the class is not public. */
  5. class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner numberInputReader = new Scanner(System.in);
  10.  
  11. int num1;
  12.  
  13. num1 = numberInputReader.nextInt();
  14.  
  15. System.out.println("My number is " + num1);
  16.  
  17. num1 = num1 - 1;
  18.  
  19. System.out.println("And the number minus 1 is " + num1);
  20.  
  21. }
  22. }
Success #stdin #stdout 0.05s 246144KB
stdin
10
stdout
My number is 10
And the number minus 1 is 9