/* from
N o w J a v a . c o m*/
//package com.nowjava;
public class Main {
public static void main(String[] argv) throws Exception {
String word = "nowjava.com";
String[] array = new String[] { "1", "abc", "level", null,
"nowjava.com", "asdf 123" };
System.out.println(wordAlreadyAdded(word, array));
}
/**
* Determines whether a specified word has already been added to the array.
*
* @param word
* -- the word to search for in the array
* @param array
* -- the array to be searched
* @return whether the word has already been added to the array
*/
private static boolean wordAlreadyAdded(String word, String[] array) {
for (int i = 0; i < array.length; i++) {
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。