Download dell'intero lavoro - Provincia di Torino
Download dell'intero lavoro - Provincia di Torino
Download dell'intero lavoro - Provincia di Torino
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
ARRAY DI ARRAY<br />
ARRAY DI OGGETTI<br />
short [ ] [ ] a; /* array <strong>di</strong> array <strong>di</strong> short */<br />
short a[ ] [ ]; /* equivalente */<br />
a = new short [3][2];<br />
a<br />
a[2][0]<br />
class Automobile {<br />
public int targa;<br />
public int velocità;<br />
….<br />
}<br />
….<br />
Automobile[ ] a=new Automobile[3];<br />
a<br />
heap<br />
heap<br />
a = new short [3][ ];<br />
a<br />
null null null<br />
a[2].targa<br />
heap<br />
Introduzione al linguaggio Java 97<br />
Introduzione al linguaggio Java 98<br />
STRUTTURE DI CONTROLLO:<br />
SINTESI<br />
STRUTTURE DI CONTROLLO<br />
Sequenza<br />
Selezione<br />
Iterazione<br />
if<br />
switch<br />
for<br />
while<br />
do-while<br />
Salto break uscita da un blocco<br />
continue continua un loop<br />
return da un metodo<br />
Gestione ecce- try-catchzioni<br />
finally-throw<br />
Non c’è goto!<br />
Introduzione al linguaggio Java 99<br />
Introduzione al linguaggio Java 100<br />
boolean,<br />
non integer!<br />
SINTASSI<br />
if ( con<strong>di</strong>tion ) switch ( intexpr ) {<br />
statement;<br />
case intexpr : statement;<br />
[else<br />
[case intexpr : statement;<br />
statement; ] ...<br />
default : statement; ]<br />
}<br />
while ( con<strong>di</strong>tion )<br />
statement;<br />
for ( init; con<strong>di</strong>tion; increment )<br />
do<br />
statement;<br />
statement;<br />
while ( con<strong>di</strong>tion );<br />
• break [label];<br />
• continue [label];<br />
• return expr;<br />
• label: statement<br />
USCITE<br />
Introduzione al linguaggio Java 101<br />
Introduzione al linguaggio Java 102<br />
Introduzione al linguaggio Java 17<br />
17