fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Check
  9. {
  10. boolean isPermutation(String x,String y)
  11. {
  12. int q=length(x);
  13. int w=length(y);
  14. if(q==w)
  15. {
  16. for(int i=0;i<w;i++)
  17. {
  18. char r=x.indexOf(i);
  19. for(int j=0;j<w;j++)
  20. {
  21. char s=y.indexOf(j);
  22. if(r==s)
  23. break;
  24.  
  25. }
  26. if(j==w)
  27. return 0;
  28. }
  29. return 1;
  30. }
  31.  
  32. }
  33. }
  34. class Permutation
  35. {
  36. public static void main (String[] args)
  37. {
  38. {
  39. Check c=new Check();
  40. boolean o=c.isPermutation("abc","bca");
  41. }
  42. }
  43. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: cannot find symbol
		int q=length(x);
		      ^
  symbol:   method length(String)
  location: class Check
Main.java:13: error: cannot find symbol
		int w=length(y);
		      ^
  symbol:   method length(String)
  location: class Check
Main.java:18: error: possible loss of precision
				char r=x.indexOf(i);
				                ^
  required: char
  found:    int
Main.java:21: error: possible loss of precision
					char s=y.indexOf(j);
					                ^
  required: char
  found:    int
Main.java:26: error: cannot find symbol
			if(j==w)
			   ^
  symbol:   variable j
  location: class Check
Main.java:27: error: incompatible types
			return 0;
			       ^
  required: boolean
  found:    int
Main.java:29: error: incompatible types
		return 1;	
		       ^
  required: boolean
  found:    int
7 errors
stdout
Standard output is empty