fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.Scanner;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. int temp=0;
  12. public void checkPalindrom()
  13. {
  14. int sum=0,r,n;
  15. Scanner sc=new Scanner(System.in);
  16. System.out.println("enter the number");
  17. sc.nextInt();
  18. while(n>0)
  19. {
  20. r=n%10;
  21. sum=(sum*10)+r;
  22. n=n/10;
  23. }
  24. if(temp==sum)
  25. System.out.println("palindrome");
  26. else
  27. System.out.println("not palindrome");
  28.  
  29. }
  30. public static void main (String[] args) throws java.lang.Exception
  31. {
  32. Ideone i=new Ideone();
  33. i.checkPalindrom();
  34. }
  35. }
Compilation error #stdin compilation error #stdout 0.1s 3359744KB
stdin
Standard input is empty
compilation info
Main.java:18: error: variable n might not have been initialized
	while(n>0)
	      ^
1 error
stdout
Standard output is empty