java - 找不到符号错误

标签 java compiler-errors

提前感谢您帮助解决我似乎遇到的这个相对简单(我希望)的问题。每当我尝试编译我的编程作业时,我都会遇到“找不到符号错误”。我指出代码本身发生错误的位置。再次感谢!

    public class SSN
{
    private int one;
    private int two;
    private int three;

    public SSN(int first, int second, int third) throws Exception
    {
        if(first > 99 || first < 1 || second > 999 || second < 1 || third > 9999 || third < 1)
        {

        }
        else
        {
            one = first;
            two = second;
            three = third;
        }
    }

    //method that turns ###-##-#### string into 3 int SSN object
    public static SSN valueOf(String ssn)
    {

    String firstpart;
    firstpart = ssn.substring(0, 2);
    String secondpart;
    secondpart = ssn.substring(4, 5);
    String thirdpart;
    thirdpart = ssn.substring(7, 10);

    int One = Integer.parseInt(firstpart);
    int Two = Integer.parseInt(secondpart);
    int Three = Integer.parseInt(thirdpart);

    System.out.println(firstpart);

        //This is where the cannot find symbol error occurs (return SSN(One, Two, Three),                                       //and I am clueless as to why.
        //Any insight as to why this error is occurring would be much appreciated!

    return SSN(One, Two, Three);
    }


    public String toString()
    {
        return one + "-" + two + "-" + three;
    }

}

最佳答案

return new SSN(One, Two, Three);
       ^^^

关于java - 找不到符号错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5823193/

相关文章:

java - android中的 Action TIME_SET被多次调用而无需手动更改时间

ios - Watchkit 错误 : WatchKit Extension contains multiple WatchKit apps

haskell - 无法将预期的 `Int'类型与实际的 `IO [Int]'类型相匹配

c - 我缺少什么,所以我可以编译我的源代码?我是新手

eclipse - MacOS-GoClipse GAE- "open build: No such file or directory"

java - 比较日期以查找匹配的年份和月份

java - 通过java运行Kettle转换

java - 一段时间后检查 NFC 是否仍然启用

java - Java API 到底是如何与 JVM 交互的?

c++ - 编译器错误: not declared in the scope