Mein erster Stappel
Quiz yourself by thinking what should be in
each of the black spaces below before clicking
on it to display the answer.
Help!
|
|
||||
---|---|---|---|---|---|
Was wird ausgegeben? String s1="10"; String s2="12"; System.out.println(s1+s2); | Lösung: 1012
🗑
|
||||
Wo liegt der Fehler, warum ist das falsch und wie lässt er sich berichtigen? int i = 15, j=10; byte b = i+j; System.out.println(b); | Lösung: Zeile 2, implizite Konvertierung von int zu byte verboten, weil der Wertebereich überschritten werden kann, auch wenn das hier nicht der Fall ist
-> Explizite Konvertierung
-> byte b = (byte)(i+j);
🗑
|
||||
Ist dieses Programm fehlerhaft und welche Werte befinden sich am Ende im Array? int[] a = new int[5]; for(int i=1;i<=a.length;i++) { a[i] = i; } | Lösung: Nix;1;2;3;4
-> Zudem wird es eine Bereichsüberschreitung geben, da ein Arrayindex bei 0 beginnt und es kein Arrayfeld 5 gibt
🗑
|
||||
Wieso kann hier zur Laufzeit leicht ein Fehler auftreten? Scanner s = new Scanner(System.in); int i= s.nextInt(); s.close(); | Lösung: Das Programm wird eine Ausnahme produzieren, wenn der Benutzer einen String oder eine Fließkommazahl eingibt
🗑
|
||||
Bei welchen Werten von i wird eine Endlosschleife ausgelöst? boolean b = true; int i = ???, j=0; while(b) { if(i%3 == 1) { j++; } else if(i%3 == 2) { j += 2; } if(j > 10) { break; } } System.out.println("Bin fer | Lösung: 0, 3, 6, 9 … (Vielfache von 3)
🗑
|
Review the information in the table. When you are ready to quiz yourself you can hide individual columns or the entire table. Then you can click on the empty cells to reveal the answer. Try to recall what will be displayed before clicking the empty cell.
To hide a column, click on the column name.
To hide the entire table, click on the "Hide All" button.
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.
To hide a column, click on the column name.
To hide the entire table, click on the "Hide All" button.
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.
Normal Size Small Size show me how
Normal Size Small Size show me how
Created by:
jurajwht
Popular Math sets