Source code for UseTheForceExample.java:

public class UseTheForceExample
{
	public static void main(String args[])
	{
		// UseTheForceExample
		String force = "Use the force, Luke!";
		String key = "Luke";
		int index = force.indexOf(key);
		System.out.println("Found key at " + index);
	}
}

Output from UseTheForceExample.java:

Found key at 15

--- Output Ends ---

NOTE:

You are reading previously generated output. You are not currently running the UseTheForceExample application at the momement. You need to compile and run the source code first.

To run this program:


Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR