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



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

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions 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

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. How to fetch a value from a database in dropdown b
View Tutorial          By: lara at 2014-11-19 09:02:43

2. Good one.........!!!
View Tutorial          By: Shailesh Nakade at 2012-07-11 09:48:33

3. Hi every body.. I accomplished the task of sending
View Tutorial          By: Ashray P Shetty at 2010-11-18 06:25:54

4. hiii frds i want to run this program can i run usi
View Tutorial          By: arun kumar ojha at 2011-07-20 00:59:10

5. Thank you I have understood the flow now.
<

View Tutorial          By: Shyam at 2012-05-17 13:14:40

6. sir can you write the sample proram of this:

View Tutorial          By: bryan labastida at 2011-06-29 02:53:14

7. Hi! Ramlak It Working But Sms didnot send why? and
View Tutorial          By: balaji at 2008-01-28 02:41:47

8. dear sir/madam
I am using netbeans IDE 7.0

View Tutorial          By: bangaram at 2011-07-19 12:03:04

9. Hi,.
No Change yaar, Im still getting the s

View Tutorial          By: Dinesh Rajendiran at 2012-03-23 05:19:06

10. The arraycopy in a System is static native method
View Tutorial          By: Ashwinkumar.vj at 2011-07-19 09:25:02