CH9 – The indexOf Method

  1. Open DrJava and expand the Interactions pane.
  2. Enter the following code.
Welcome to DrJava.  Working directory is /Users/jamesbrannan
> String fruit="banana";
> int index = fruit.indexOf('a');
> index
1
> int index = fruit.indexOf('a', 2);
> index
3