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
4 Antworten
+ 2
I made some changes for your code Aman sharma
https://code.sololearn.com/cHHf22ePW151/?ref=app
+ 1
Ipang In vain
+ 1
Makar Mikhalchenko Can you help?
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 😉✌️