Java Int to String

  • + 0 comments

    yo lo hice de la siguiente manera try { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.close();

            Integer num = n;
            String s = num.toString();
    
            if (n == Integer.parseInt(s)) {
                System.out.println("Good job");
            } else {
                System.out.println("Wrong answer.");
            }
        } catch (DoNotTerminate.ExitTrappedException e) {
    
            System.out.println("Unsuccessful Termination!!");
        }