Comment on Tutorial - indexOf( ) and lastIndexOf( ) in Java By Hong
Comment Added by : vallabh
Comment Added at : 2014-10-04 17:44:18
Comment on Tutorial : indexOf( ) and lastIndexOf( ) in Java By Hong
u can try this out it will satisify u:)
import java.io.*;
public class lastindexof
{
public static void main(String[] args) throws IOException
{
String mystr;
int cou=0;
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
System.out.print("enter the string");
mystr=bf.readLine();
System.out.println("enter the string ");
String st=bf.readLine();
for(int i=0;i<mystr.length()-1;i++)
{
if(mystr.indexOf(st)!=-1)
cou++;
}
System.out.println(" character at position is=" +mystr.indexOf(st));
System.out.println(cou);;
}
}
View Tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java
Archived Comments
1. nice one its very useful
View Tutorial By: jhejhe at 2010-02-21 05:03:50
2. It is very useful.thank you so much.
View Tutorial By: Pratiksha ijagaj at 2010-11-27 07:03:52
3. I am trying to connect mobile to PC. I put your ex
View Tutorial By: Dedo at 2011-11-30 17:45:32
4. really very excellent example....ThanQ...:)
View Tutorial By: Tulasi at 2010-08-17 00:41:21
5. Thanks to java-samples.com website. and very usefu
View Tutorial By: Samuel . A at 2010-01-29 01:29:51
6. Hi, You can use a javascript array. Which means wh
View Tutorial By: Mashoud at 2008-05-04 02:54:38
7. can i have sample of java programming that has dat
View Tutorial By: piolo at 2009-05-31 18:53:25
8. Hi,
this is excellent stuff and I highly ap
View Tutorial By: Nanda at 2007-11-02 04:58:30
9. hi, IF ANY ONE REALLY INTRESTED TO RUN THIS PROGRA
View Tutorial By: sunil kumar sahu at 2010-10-09 11:50:56
10. Please send me application for sending message on
View Tutorial By: jigar at 2011-12-21 11:53:48