The value of the local variable is not used

后端 未结 2 1973
予麋鹿
予麋鹿 2021-01-29 16:29

all of the variables above have the warning in the title. Could you please tell me why that is happening?

public class DataTypes {
    public static void main(St         


        
相关标签:
2条回答
  • 2021-01-29 16:44

    You have defined the variables: x, y, ssn, phone, num and twoLine. But you never use the variables anywhere in the code. For instance, if you print the variables out:

    System.out.println(x + y + ssn + phone + num + twoLine);
    

    All the warnings should disappear

    0 讨论(0)
  • 2021-01-29 16:46

    The variables you declared are never used, only assigned to, therefore you're being warned.

    0 讨论(0)
提交回复
热议问题