Java Int to String

Sort by

recency

|

783 Discussions

|

  • + 0 comments

    import java.io.; import java.util.;

    public class Solution {

    public static void main(String[] args) {
    
    Scanner scanner = new Scanner(System.in);
    int number = scanner.nextInt();
    
    if (number >= -100 && number <= 100){
        System.out.println("Good job");
    }
    else{
        System.out.println("Wrong answer");
    }
    
    }
    

    }

  • + 0 comments

    just print "good job" without any reading.

  • + 0 comments
    try {
       Scanner in = new Scanner(System.in);
       int n = in .nextInt();
       in.close();
       //String s=???; Complete this line below
        String s =Integer.toString(n);
       
       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!!");****
    
  • + 0 comments

    String s = String.valueOf(n);

  • + 1 comment
    Given task it to convert the number to string: I thought Concatination is the easy and best way
         String s=n+"";