AMALIAT21
2011-06-19 21:51:03 UTC
import java.util.*;
import java.util.InputMismatchException;
public class A08
{
public static void main(String[]args)
{
//get filename from user
Scanner keybd = new Scanner(System.in);
System.out.println("Enter a filename to convert: ");
String input = keybd.nextLine();
//trim filename to disregard whitespace characters
String file;
file = input.trim();
System.out.println("Filename: " + file);
//get
int period;
period = file.lastIndexOf();
System.out.println("Period is position: " + period);
}
}
When i try to compile, I get the following error:
1 error
atjs-MacBook-Pro:ICS111 atj$ javac A08.java
A08.java:20: cannot find symbol
symbol : method lastIndexOf()
location: class java.lang.String
period = file.lastIndexOf();
^
I am new to Java. I dont understand what I have to change so that it will compile. Any advice is appreciated. Thank you!