Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Ausgabe der Arrayinhalte mithilfe der 3 Schleifentypen
- *
- * @author Marcel
- * @version 26.11.2014
- */
- public class Zahlen
- {
- public static void zahlenfor(String[] args) {
- int[] zahlen = {1, 2, 3, 4, 5};
- for(int i=0; i<5; ++i) {
- System.out.print(zahlen[i]+" ");
- }
- }
- public static void zahlenwhile(String[] args) {
- int[] zahlen = {6, 7, 8, 9, 10};
- int i = 0;
- while (i < 5) {
- System.out.print(zahlen[i]+" ");
- i++;
- }
- }
- public static void zahlendo(String[] args) {
- int[] zahlen = {11, 12, 13, 14, 15};
- int i = 0;
- do
- {
- System.out.print(zahlen[i]+" ");
- i++;
- }
- while(i < 5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement