Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

I have a String s = java; What is the output when I say
s.replaceAll('j', 'k'); Also what is the value of s after
replacing?

Answer Posted / prachi

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method replaceAll(String, String) in the type String is not applicable for the arguments (char, char)






will be thrown because in replaceAll(‘j’,’k’) : j & k are in single quote which defines as character not as string. For correct output first replace single quote with double quotes and second write s = s.replaceAll(“j”, “k”);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is JVM and is it platform independent?

996


What is internal iteration in java se 8?

1136


If I only change the return type, does the method become overloaded?

881


How to do encapsulation in java?

1009


Can list contain null in java?

1037


What are the special characters?

935


Is singleton class immutable?

914


What modifiers may be used with an inner class that is a member of an outer class in java programming?

1025


What is blank final variable?

1024


Why char array is favored over string for the storage of passwords?

1009


What is meant by null and void?

929


What are local variables?

1012


Does java have extension methods?

918


What is the method to expand and collapse nodes in a jtree?

988


What do you understand by private, protected and public?

1003