错误:找不到符号?

时间:2016-02-15 00:26:33

标签: java

嘿我不明白为什么这段代码错了我很确定我做的一切都是正确的逻辑。我认为它的情况如此敏感我是对的吗?

Function Test(Testvalue As String, TargetRange As Range) As String
  Dim d As Object: Set d = CreateObject("Scripting.Dictionary")
  Dim c As Range
  For Each c In TargetRange
    If c.Value2 = Testvalue Then d.Add c.Address(0, 0), ""
  Next
  Test = Join(d.keys, ","):  Set d = Nothing
End Function

3 个答案:

答案 0 :(得分:0)

您错误拼写Scanner方法名称,它们应该是:

System.out.println("Enter item: ");
String name = input.nextLine();

System.out.println("Enter Price: ");
double price = input.nextDouble();

System.out.println("Enter Quantity: ");
int m = input.nextInt();

答案 1 :(得分:0)

尝试更正Scanner类的这些方法名称:

 input.nextline();
 ...
 input.nextdouble();
 ...
 input.nextint();

使用正确的名称编写它们因为java区分大小写:

 input.nextLine();
 ...
 input.nextDouble();
 ...
 input.nextInt();

答案 2 :(得分:0)

Java区分大小写,您拼错了该方法 nextline() - > nextLine()
nextdouble() - > nextDouble()

import java.util.Scanner;

public class Letgoshop {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.println("Enter item: ");
        String name = input.nextLine();

        System.out.println("Enter Price: ");
        double price = input.nextDouble();

        System.out.println("Enter Quantity: ");
        int m = input.nextInt();

        System.out.print("You owe $" + m * price + " for " + m + " " + name.toUpperCase() + "(S)");

    } 
}