Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Ideone {
- public static void main (String[] args) throws java.lang.Exception {
- Integer a[] = {1,2,3,4,5,6,7};
- int b[] = {1,2,3,4,5,6,7};
- Arrays.sort(a, (x,y) -> y-x);
- //Arrays.sort(b, (x,y) -> y-x);
- System.out.println(Arrays.toString(a));
- System.out.println(Arrays.toString(b));
- }
- }
- Main.java:11: error: no suitable method found for sort(int[],(x,y)->y - x)
- Arrays.sort(b, (x,y) -> y-x);
- ^
- method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable
- (inference variable T#1 has incompatible bounds
- equality constraints: int
- upper bounds: Object)
- method Arrays.<T#2>sort(T#2[],int,int,Comparator<? super T#2>) is not applicable
- (cannot infer type-variable(s) T#2
- (actual and formal argument lists differ in length))
- where T#1,T#2 are type-variables:
- T#1 extends Object declared in method <T#1>sort(T#1[],Comparator<? super T#1>)
- T#2 extends Object declared in method <T#2>sort(T#2[],int,int,Comparator<? super T#2>)
- Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
- 1 error
Add Comment
Please, Sign In to add comment