Your problem
You need to remove the quotation marks around the variable name.
int pos=s.lastIndexOf("dot");
becomes
int pos=s.lastIndexOf(dot);
Just an aside
This could have been worked out, VERY easily by yourself if you'd used a debugger. I can't help but feel you've used SO as a first resort, rather than what it should be; a place to go when you've really exhausted all methods of investigation that you are personally aware of.
A debugger
Almost every single IDE (Eclipse, Netbeans etc) have something called a debugger. A debugger allows you to go through your program line by line, and see the value of every single variable as the program develops. If you're using Eclipse, on the toolbar along the top, select Run -> Debug
, to initialize the program in debugging mode. For Netbeans, there is a debug button on the right of the Run button (The play symbol). Just a few examples.