AL lab-1
Rizoyev Sunnatillo
Savol:
Talabalar ismlarini alifbo tartibida saralash:
Dastur kodi:
package com.company;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
ArrayLista=new ArrayList();
a.add("Sunnat");
a.add("Nurbek");
a.add("Rashid");
a.add("Abdulaziz");
a.add("Muhammad");
System.out.println(a);
Collections.sort(a);
System.out.println("saralashdan keyin:");
System.out.println(a);
}
}
natijasi:
Do'stlaringiz bilan baham: |