objectarrayexample.java
来自「< Professional Java,JDK 5 Edition>」· Java 代码 · 共 25 行
JAVA
25 行
public class ObjectArrayExample {
public native int findString(String[] stringList, String stringToFind);
static {
System.loadLibrary("ObjectArrayLibrary");
}
public static void main(String args[])
{
ObjectArrayExample oae = new ObjectArrayExample();
String[] colors = {"red","blue","black","green","grey"};
int foundIndex;
System.out.println("Searching for 'black'...");
foundIndex = oae.findString(colors, "black");
if(foundIndex != -1) {
System.out.println("The color 'black' was found at index " + foundIndex);
} else {
System.out.println("The color 'black' was not found");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?