Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. class Noote implements Comparable {
  2. int a;
  3. int b;
  4.  
  5. Noote(int a, int b) {
  6. this.a = a;
  7. this.b = b;
  8. }
  9.  
  10. @Override
  11. public int compareTo(Object o) {
  12. {
  13. Noote tmp = (Noote) o;
  14. if (this.a > tmp.a) {
  15. return 1;
  16. }
  17. if (this.a < tmp.a) {
  18. return -1;
  19. }
  20.  
  21. }
  22. return 0;
  23. }
  24.  
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. --------------------------------------------------------------
  33.  
  34.  
  35. int n = readInt();
  36. Noote[] NooteBooks = new Noote[n];
  37. for (int i =0;i<0;i++){
  38. int a =readInt();
  39. int b =readInt();
  40. NooteBooks[i]=new Noote(a,b);
  41. }
  42.  
  43. out.println(NooteBooks[1]);
  44. Arrays.sort(NooteBooks);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement