Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

the string method lastIndexOf

807597Jan 11 2005 — edited Jan 11 2005
Hi all,
I am new to Java Programming an d just started a week ago!I am just learning about strings right now and I hit a stone today with a little program:)

<HTML>
<HEAD>
<TITLE>Creating a String</TITLE>
</HEAD>

<BODY>
<H1>Creating a String</H1>
<%
String jsp = "JavaServer Pages is going to dominate the world!" ;
int index=jsp.lastIndexOf("dominate");
out.println(index);
%>
</BODY>
</HTML>


That is my programm,but the point is,that the method lastIndexOf don't get me the last index but the first!So when I run the programm I get the result 29 printed on my page,which is the same number generated ba the indexOf method!I don't have any idia why is that and i will really really appreciate your help!
Thanx verry much!
Best regards Daisy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 8 2005
Added on Jan 11 2005
6 comments
323 views