Created
September 3, 2020 17:54
-
-
Save mrnirva/fd0b05642b1bf81d292664cd56103a32 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; | |
public class ArraysSinifi { | |
public static void main(String[] args) { | |
/* | |
Dizilerde arama yapabilmek için öncelikle | |
dizi sıralamamız gerekiyor. Daha sonra sıraladığımız | |
dizide arama yapabiliriz. | |
*/ | |
String[] programlamaDilleri = {"C++","Java","COBOL","C","Assembly","Python"}; | |
Arrays.sort(programlamaDilleri); | |
System.out.println("******** Sıralı Dizi *********"); | |
for (String string : programlamaDilleri) { | |
System.out.println(string); | |
} | |
System.out.println("******************"); | |
System.out.println(Arrays.binarySearch(programlamaDilleri, "Java")); | |
// İlk parametreye diziyi ikinci parametreye aradığımız veriyi giriyoruz | |
// Bulursa indisini dönüyor | |
// Bulamazsa negatif değer dönüyor | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment