Answer to Question #219992 in Java | JSP | JSF for Imran

Question #219992

A schoolboy named ‘Jala kondapathi’ was living in a small village. But his full name is Jala

Kondapathi Rao in the registered certificates. He has joined the college after a school in a

city. His friends are called his name as “Jala Pathi Rao”. But he likes to call “Pathi”.

Write a java program to read name ‘Jala Kondapathi’ initially. Then modify the names as

per the sequence given above. Use StringBuffer Class methods to do changes in the name


1
Expert's answer
2021-07-24T07:06:41-0400


public class Main
{
	public static void main(String[] args) {
	    String name = "Jala kondapathi";
		StringBuffer string =new StringBuffer(name);  
	
		int n = string.length();
string.replace(0,n,"Jala Pathi Rao");  
System.out.println("Friends calls him \t"+string);
int final_n  = string.length();
string.replace(0,n,"Pathi"); 
System.out.println("He likes to call \t"+string);  
	}
}


Go to https://onlinegdb.com/3E-7KS8jF to compile and run


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS