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

后端 未结 8 1155
半阙折子戏
半阙折子戏 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条回答
  •  旧时难觅i
    2020-11-27 23:36

    linkCost is not initialized when link == 'y' and advPay is not 'y' or 'n'.

    In other words, you get this error when the compiler can find a path through your code where a local variable is not initialized before it is used.

提交回复
热议问题