0

Please replace all red words to String without using in-built functions.

I am sharing my try with you all pls make the corrections and share. I did it by Making String array with values StringName. split but that's an in built function so not acceptable. https://code.sololearn.com/c5755Qu6JbTe/?ref=app Required output : GREEN BOTTLE IS IN GREEN BAG ON GREEN CARPET

12th Feb 2021, 2:59 AM
Aman sharma
4 Respuestas
12th Feb 2021, 3:21 AM
Ipang
+ 1
Ipang In vain
12th Feb 2021, 6:25 AM
Aman sharma
+ 1
Makar Mikhalchenko Can you help?
12th Feb 2021, 6:25 AM
Aman sharma
0
Ipang Your code produces the desired output but it's not as per my requirements 😔, if we had to use String in-built methods than I could have done it on my own 😊 Class Name { public static void main (String[] args) { String str="RED BOTTLE IS IN RED BAG ON RED CARPET"; String[] arr=str.split(" ") ; for(int i=0;i<arr.length;i++) { if(arr[i]=="RED") { arr[i]="GREEN" ; } System.out.print(arr[i]+" ") ; } } } But it's not correct for the approach 😉✌️
12th Feb 2021, 11:55 AM
Aman sharma