Variables might not have been initialized

前端 未结 3 1823
感情败类
感情败类 2020-12-04 03:46
import java.util.Scanner;

public class ZodiacSign{

        public static void main(String args[]){

        Scanner input = new Scanner(System.in);
        int   F         


        
3条回答
  •  不思量自难忘°
    2020-12-04 03:51

    Change the following line

    int   Feb,March,ZodiacSign,Pisces,Aquarius,Aries,Taurus;
    

    to

    int   Feb=0,March=0,ZodiacSign=0,Pisces=0,Aquarius=0,Aries=0,Taurus=0;
    

    Method variables need some initial assignment before they are used. So do the same with all the other method variables.

提交回复
热议问题