Created
March 18, 2013 12:20
-
-
Save nuryslyrt/5186789 to your computer and use it in GitHub Desktop.
Kendisi kullanıcıyla dizi oluşturup daha sonra o dizide eleman arar.
This file contains hidden or 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
import java.util.Scanner; | |
public class Diziler { | |
private static Scanner scan; | |
public static void diziyap(String[] args) { | |
scan = new Scanner(System.in); | |
System.out.print("boyut girsene\n"); | |
String[] dizi = new String[scan.nextInt()]; | |
for (int i = 1; i <= dizi.length; i++) { | |
System.out.println(i + ".elemanı gir ama string olsun :)\n"); | |
dizi[i-1] = scan.nextLine(); | |
} | |
} | |
private static void buldum(String[] dizi12) { | |
String buluncak; | |
scan = new Scanner(System.in); | |
System.out.print("ne aramak istersin ?"); | |
buluncak = scan.nextLine(); | |
for (int j = 0; j <= (dizi12.length)-1; j++) { | |
if (buluncak.equals(dizi12[j])) { | |
System.out.println(j + ".eleman benim!\n"); | |
} | |
} | |
} | |
public static void main(String[] args) { | |
diziyap(args); | |
buldum(args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment