3:52 am - Monday June 25, 2018

StringBuilder Example Program for setCharAt(int index,char ch)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
@Author: Candidjava.com
Description: source code to print the index of last occurance of a particular character in a given input string .
*/
import java.io.*;
import java.lang.String;
public class Slastindexof
{
public static void main(String[] args)throws IOException
{
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter the string");
String str1=bf.readLine();
int i=str1.lastIndexOf("j");
// if the given string is jajery ..?.den the o/p ll be two(2) ..
//since this method prints the last occurance of the given string"
System.out.println(i);
}
}

Output:
enter the string
Candid java
7

BACK

Filed in: Z-A All Java Codes

Comments are closed.