Java Int to String

  • + 0 comments

    The solution without any additional code🧠

    import java.io.*;
    import java.util.*;
    
    public class Solution {
    
        public static void main(String[] args) {
            try (Scanner scanner = new Scanner(System.in)) {
                int n = scanner.nextInt();
                String str = String.valueOf(n);
                
                if (n == Integer.parseInt(str)) {
                    System.out.println("Good job");
                }
            } catch(Exception ex) {
                System.out.println("Wrong answer");
            }
        }
    }