package Livecoding;

public class Spicker {
    public static void main(String[] args){
        // impliziter cast
        int intZahl = 1;
        double dZahl = intZahl;

        // expliziter Cast
        dZahl = 1.9;
        intZahl = (int) dZahl;

        boolean istGut = true;
        int zahl = 0;
        if(!istGut){
            System.out.println("A");
        } else if(istGut && zahl == 0){
            System.out.print("C");
        } else {
            System.out.println("B");
        }

        //... weiter im Text


        // Switch
        int a = 1;
        switch(a){
            case 1:
                System.out.print("Hallo");
                break;
            case 2:
                System.out.print("Ciao");
                break;
            default:
                System.out.print("Nix passiert");
        }

        // Schleifen
        int b = 0, c = 0, d=0;
        while(b<010) {b++; }
        do{c++;}while(c<=10);

        for(int i1= 0; i1<=10; i1++) {d++;}

        // Methoden
        methodenOhneReturn(b);

        int f = methodeMitReturn(2,5);

        // arrays:
        int[] meinArray = new int[] {3,5,3,2};
        int[] meinArray2 = new int[4];
        // meinArray[0] = 3; //...
        for(int i=0; i<meinArray.length;i++){
            System.out.println(meinArray[1]);
        }

        // Variante 2: foreach -Schleife
        for(int element:meinArray)
            System.out.println(element);
    }


    // Methoden
    public static void methodenOhneReturn(int a){
        System.out.print(a);
    }
    public static int methodeMitReturn( int a, int b){
        return a+b;
    }
}
