Hi the following code executes nothing but I want it to execute”H#e#l#l#l#o# t#h#e#r#e#!#”:
public class tag{
public static void main(String[]args){
String s = “Hello there!”;
String s2 = “”;
int index=0;
for(int x=0; x<10;x++){
if(s.indexOf(index) != -1){
s2 = s2 + s.charAt(x) + “#”;
index++;
}
else if (x > s.length()){
System.out.print(“x”);
}
}
System.out.println(s2);
}
}
Expert Answer
An answer will be send to you shortly. . . . .