// Writers.java (c) 2003 Kari Laitinen class Writers { public static void main( String[] not_used ) { String names_of_writers = "James Joyce Leo Tolstoy Ernest Hemingway" ; System.out.print( "\n 01234567890123456789012345678901234567890123" + "\n " + names_of_writers + "\n" ) ; int index_of_substring = names_of_writers.indexOf( "Joy" ) ; System.out.print( "\n The index of Joy is " + index_of_substring ) ; System.out.print( "\n The index of toy is " + names_of_writers.indexOf( "toy" ) ) ; System.out.print( "\n The index of John Steinbeck is " + names_of_writers.indexOf( "John Steinbeck" ) ) ; String irish_writer = names_of_writers.substring( 0, 11 ) ; System.out.print( "\n The irish writer is " + irish_writer ) ; String russian_writer = names_of_writers.substring( names_of_writers.indexOf( "Leo" ), names_of_writers.lastIndexOf( " " ) ) ; System.out.print( "\n The russian writer is " + russian_writer ) ; System.out.print( "\n The 38th character is " + names_of_writers.charAt( 37 ) ) ; } }