Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.List;
- import java.util.ArrayList;
- import java.util.Arrays;
- interface Student{
- String kierunek = "Informatyka";
- String getK();
- }
- public class StudentInformatyki implements Student, Comparable<StudentInformatyki>{
- int indeks;
- int getI(){
- return this.indeks;
- }
- void setI(int indeks){
- this.indeks = indeks;
- }
- public String getK(){
- return kierunek;
- }
- public StudentInformatyki(int indeks){}
- public static void main(String[] args){
- StudentInformatyki A[] = new StudentInformatyki[4];
- A[0] = new StudentInformatyki(343);
- A[1] = new StudentInformatyki(341);
- A[2] = new StudentInformatyki(345);
- A[3] = new StudentInformatyki(342);
- for(int i=0; i<4; i++){
- System.out.println(A[i].getI());
- }
- Arrays.sort(A);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement