//cd c:\JavaTry\Application1 //javac StringDemo2.java //set CLASSPATH=. //java StringDemo2 class StringDemo2 { public static void main(String[] args) { String s="These real-world objects share two characteristics: They all have state and behavior. For example, dogs have state (name, color, breed, hungry) and behavior (barking, fetching, and wagging tail). Bicycles have state (current gear, current pedal cadence, two wheels, number of gears) and behavior (braking, accelerating, slowing down, changing gears). (From http://java.sun.com/docs/books/tutorial/java/concepts/object.html)"; int i = s.indexOf("objects"); System.out.println(i); } } /* C:\JavaTry\Application1>java StringDemo2 17 */