codice:
import prog.io.ConsoleInputManager;
import prog.io.ConsoleOutputManager;
public class ConcatenaStringhe{
public static void main(String[] args){
ConsoleOutputManager video = new ConsoleOutputManager();
ConsoleInputManager tastiera = new ConsoleInputManager();
StringBuffer testo1 = new StringBuffer(tastiera.readLine("\nInserire prima Stringa: ") + " ");
StringBuffer testo2 = new StringBuffer(tastiera.readLine("\nInserire seconda Stringa: "));
StringBuffer concat = new StringBuffer();
concat.setLength(testo1.length() + testo2.length());
char c;
int i;
for(i = 0; i < testo1.length(); i++){
c = testo1.charAt(i);
concat.setCharAt(i,c);
}
for(int j = 0; j < testo2.length(); j++, i++){
c = testo2.charAt(j);
concat.setCharAt(i,c);
}
video.println("\nStringa Concatenata: "+concat);
}
}
Funziona! Yuppi!
Grazie mille