Java Int to String

Sort by

recency

|

803 Discussions

|

  • + 0 comments

    This question was not confusing at all. Very clear !!!

  • + 0 comments

    **Only one line code **

    String s = Integer.toString(n);
    
  • + 0 comments

    i am totally confused. because of i am writing again and again if condition unnecessary. after i realised what kind of mistake doing again nd again. only i have to write one line code.

    String s=Integer.toString(n);

    that's all set.

  • + 0 comments

    Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = Integer.toString(n);

        if (s.equals(Integer.toString(n)) && (n >= -100 || n <= 100 )) {
            System.out.println("Good job");
        } else {
            System.out.println("Wrong Answer");
        }
    
  • + 0 comments

    String s = n+"";

    //second way String s2 = String.valueOf(n);

    //third way String s3 = Integer.toString(n);