Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * KK KK JJJJJJJJJJ BBBBBBBB
- * KK KK JJ BB BB
- * KKKK JJ BBBBBBBB
- * KK KK JJ JJ BB BB
- * KK KK JJJJJJ BBBBBBBBBB
- *
- * Copyright 2018 Jordy Van Kerkvoorde
- */
- package h7;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Scanner;
- /**
- *
- * @author KeeJayBe
- */
- public class Oefening6 {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- List<Integer> lijst = new ArrayList<>();
- System.out.println("Geef een getal (-1 om te stoppen): ");
- int getal = s.nextInt();
- while(getal != -1){
- lijst.add(getal);
- System.out.println("Geef een getal (-1 om te stoppen): ");
- getal = s.nextInt();
- }
- if(lijst.isEmpty()){
- System.out.println("De lijst is leeg!");
- }else{
- System.out.println("Lijst: ");
- for(int l: lijst){
- System.out.print(l + "\t");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement