![]() |
Show 150 posts per page |
.dsy:it. (http://www.dsy.it/forum/)
- Fondamenti di architettura e programmazione (http://www.dsy.it/forum/forumdisplay.php?forumid=234)
-- [Cazzola] Esercitazione 30 Nov (http://www.dsy.it/forum/showthread.php?threadid=28391)
[Cazzola] Esercitazione 30 Nov
Qualcuno sa come si svolge il primo esercizio dell'esercitazione di oggi... ci stò impazzendo da quasi due oreeee!!
Grazie!!
Gia che ci sono chiedo aiuto anche per il terzo esercizio...
che mi da errore nella seconda istruzione del ciclo for dicendomi:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
*******************
int l, l1, l2, i, j;
char aux1, aux2;
StringBuffer s1 = new StringBuffer(in.readLine("Stringa1: "));
StringBuffer s2 = new StringBuffer(in.readLine("Stringa2: "));
l1 = s1.length();
l2 = s2.length();
l = l1+l2;
StringBuffer s = new StringBuffer(l);
for (i=0;i<l1;i++) {
aux1=s1.charAt(i);
s.setCharAt(i,aux1);
}
for (j=0;j<l2;i++) {
aux2=s2.charAt(j);
s.setCharAt((j+l1),aux2);
}
out.println("Stringa concatenata: " + s);
*****************************
:w
all:
All times are GMT. The time now is 23:19. | Show all 2 posts from this thread on one page |
Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.