Created
September 3, 2020 17:43
-
-
Save mrnirva/c85f3d49c56df9d14e29c3bfff6fce74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package arrayssinifi; | |
import java.util.Arrays; | |
import java.util.Collections; | |
public class ArraysSinifi { | |
public static void main(String[] args) { | |
String[] programlamaDilleri = {"C++","Java","COBOL","C","Assembly","Python"}; | |
int[] sayilar = {100,25,-5,16,87,15}; | |
// Sayıları düzgün şekilde sıralamak | |
Arrays.sort(sayilar); | |
for(int sayi : sayilar){ | |
System.out.println(sayi); | |
} | |
System.out.println("************************************"); | |
// Metinleri düzgün şekilde sıralamak | |
Arrays.sort(programlamaDilleri); | |
for(String dil : programlamaDilleri){ | |
System.out.println(dil); | |
} | |
System.out.println("************************************"); | |
/// Metinleri alfabede tersine şekilde sıralamak | |
Arrays.sort(programlamaDilleri, Collections.reverseOrder()); | |
for(String dil : programlamaDilleri){ | |
System.out.println(dil); | |
} | |
/* | |
Çıktı: | |
-5 | |
15 | |
16 | |
25 | |
87 | |
100 | |
************************************ | |
Assembly | |
C | |
C++ | |
COBOL | |
Java | |
Python | |
************************************ | |
Python | |
Java | |
COBOL | |
C++ | |
C | |
Assembly | |
*/ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment