Question: not sucess



Share on Google+Share on Google+

Nishant Jain
not sucess
0 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners

import*; public class Replace{ public static void main(String[]args) throws IOException { InputStreamReader z= new InputStreamReader(; BufferedReader br=new BufferedReader(z); System.out.println("Enter A String:"); String s=br.readLine(); System.out.println("Enter First Word:"); String w1=br.readLine(); System.out.println("Enter Second Word:"); String w2=br.readLine(); String rep=s.replace(w1,w2); System.out.println("Replaced String: "+rep); } }

Respected sir, extremely thanks to you for give me answer of my question but sir above code has a one problem when i'm input this string "This is a flower" and first word is "is" or second word is "was" then output is "Thwaswas a flower" and i want output like this e.g input string "This is a flower" first word "is " second word "was" then output will be print like this "This was a flower" not like this "Thwaswas a flower"

output after compiling your code

Enter A String: THIS IS A FLOWER Enter First Word: IS Enter Second Word: WAS Replaced String: THWASWASA FLOWER

View Answers

Related Tutorials/Questions & Answers:
Java String Split Example
args[]) { //Defining string and array String sample = "Sucess-need... OF SPLITTING STRING Splitting string at '-' Sucess need continous effort Splitting string at '.' Sucess
keeping log of page load - Java Beginners
log for sucess and failure both for page loading. Can you please give me some
java auto mail send - Struts
_to = "[email protected]", m_subject = "Hi Testing Sucess", m_text = "Hey Nallavane...,Sucess this is the testing email from our Tool
){ System.out.println("sucess entering StaffingDAO"); Session... createUsers(Users users){ System.out.println("sucess entering UsersDAO
testcases - JUNIT
"POST_FAILURE"; } else return "POST_SUCESS...) return "POST_FAILURE"; else return "POST_SUCESS
Arrays, loops and string handling
array. after successful capture of the marks, show another sucess confrimation
SQLGrammarException while trying to save data in db
mapping.findForward("sucess"); } catch (Exception e...="sucess" path="/sucess.jsp"/> <forward name="failure" path
Servlet Error Message based on user input
the sucess message otherwise it displays the error message. So, you can use Servlet
Login form in Struts2 version 2.3.16
the login sucess!!</p> </body> </html> Login success page
Java : Servlet Tutorials
. If the entered name exists in the database its displays the sucess message otherwise
Java Spring Hibernate Struts Training What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java Java Example Codes and Tutorials in 2017 How do I read a large file quickly in Java? Is learning Java worthwhile? How to create first Java Program? Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly?


Advertisement null