我有代碼一個非常基本的程序比當我輸入System.out.println時,我得到的錯誤:「引用println模糊」,隨機它使用工作,並沒有有一個錯誤,但現在它確實發生了這種錯誤,所以我如何解決這個問題,比你。對println的引用是模棱兩可的錯誤
package blue.light;
//name is: slash
import java.util.*;
public class BlueLight {
public static void main(String[] args) throws InterruptedException {
Scanner scan = new Scanner(System.in);
String name;
int age;
String a;
String yes;
String no;
double num1;
double num2;
double ans;
System.out.println("hello, my name is Slash");
System.out.println("What is your name?");
name = scan.nextLine();
System.out.println("Hello " + name);
Thread.sleep(1000);
System.out.println("How old are you?");
age = scan.nextInt();
if(age < 18)
{
System.out.println("ur young af");
}
else if (age == 21)
{
System.out.println("Shots, shots, shots");
}
else if (age == 69)
{
System.out.println("ohhh yea");
}
System.out.println("you to calculate any thing?");
a = scan.nextLine();
if(a==("yes")){
System.out.println("What would u like to do?(multiply,or add)");
a = scan.nextLine();
if(a == "add"){
System.out.println("Enter number 1");
num1 = scan.nextDouble();
System.out.println("Enter number 2");
num2 = scan.nextDouble();
ans = num1+num2;
}
}
}
}
它工作在食,但不是在NetBeans – idk0namz