Ajax
ASP
C,C++
C#,.NET
CSS,HTML
Delphi,Kylix
Experience
Flash
Java
JavaScript
PHP
Python
QT
SQL
ShellScript
VB
U :
P :
Register
Lost Password
Other Links
Code Archive
Save Giovanni
Java Category Code
Real Name
:
Secure Shell
Subject
:
Search an array using foreach
Description
:
Search an array using foreach / foreach kullanarak dizi içerisindeki elemanı arayıp bulma .
public class MainClass { public static void main(String args[]) { int nums[] = { 6, 8, 3, 7, 5, 6, 1, 4 }; int val = 5; boolean found = false; for (int x : nums) { if (x == val) { found = true; break; } } if (found) System.out.println("Value found!"); } }
Rating
:
0.00
(out of 5)
Visitor Voting Booth
:
Excellent
Very Good
Good
Fair
Poor
Copyright © 2006 SharingCode.NET . All rights reserved. Hosted By: SisNetworks