How to avoid 'the local variable may not have been initialized'?

后端 未结 8 1147
半阙折子戏
半阙折子戏 2020-11-27 23:00
/*This is a program that calculates Internet advertising rates based on what features/options you choose.
 * 
 *  
 */

import java.util.Scanner;

public class Inter         


        
8条回答
  •  情话喂你
    2020-11-27 23:26

    this happens because the assignment occurs inside a conditional, if the condition is not met, the assignment never occurs

    to avoid the error you have to assign a value (the most common would be 0) outside the conditional.

提交回复
热议问题