Why doesn't Java initialize local variables?

by noop of the noop   Last Updated May 16, 2018 13:05 PM

I can not get an answer from this error. I've replaced it several times in the error section but I still can not get the answer.

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class menu3{
public static void main(String[] args){
    List<pemain> p = new ArrayList<pemain>();
    klub kb;
    int pilih1=0,jp,j=0;
    Scanner sc = new Scanner(System.in);
    while(pilih1 !=3 ){
        System.out.println("-------------------");
        System.out.println("--------MENU-------");
        System.out.println("-------------------");
        System.out.println("1. INPUT");
        System.out.println("2. TAMPIL");
        System.out.println("3. EXIT");
        System.out.print("pilih = ");
        pilih1 = sc.nextInt();
        if (pilih1 == 1 ){
            String nmklub_;
            sc = new Scanner(System.in);
            System.out.print("NAMA klub : ");
            nmklub_ = sc.nextLine();
            System.out.print("masukan Jumlah  pemain = ");
            jp = sc.nextInt();
                for (int i=0;i<jp;i++){
                    sc = new Scanner(System.in);
                    String id_, nama_;
                    System.out.println();
                    System.out.print("no punggung = ");
                    id_ = sc.nextLine();
                    System.out.print("nama        = ");
                    nama_ = sc.nextLine();
                    p.add(new pemain(id_,nama_));
                }
                kb = new klub(nmklub_,p);

        }else if(pilih1 == 2){

            System.out.println(kb.toString());
        }
    }
}

}

....................................................................................................................................................................................................................................... enter image description here

.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Tags : java javascript


Related Questions


Error: Code too big for 64k

Updated March 29, 2015 06:01 AM


About Files converted From OCR?

Updated June 29, 2015 15:02 PM

Looking for a package to visually show this

Updated July 19, 2015 19:02 PM