What should I change to make this file compile?

老子叫甜甜 提交于 2019-12-02 14:53:15
Rots

Case sensitivity could be your issue. Check out Stack Overflow question Is Java case-sensitive?.

I would suggest altering the case of static:

public static Name findName()

A lot of your work seems wrong in this. For example, declarations of your strings.

Makoto

There are a lot of problems here. I strongly encourage you to revisit tutorials and sit down with either a tutor or TA to hammer out the core syntax understandings.

  • static is a keyword. It is case-sensitive. You must change all capitalized forms of static to lower case.

  • From what you have of your code, there isn't any class called Name. That's going to pose a huge problem.

  • nameIn is a String. It will not have a method called findName.

  • int[] popularity doesn't have any size defined to it. You will be attempting to dereference null when you go to add things to this array. Declare its size appropriately by new int[nameLine.length].

  • These lines give out false information; I presume you meant to change them to a natural numerical ordering instead of having 1 all the way down?

    System.out.println("1 - 1900-1909");
    System.out.println("2 - 1910-1919");
    System.out.println("1 - 1920-1929");
    System.out.println("1 - 1930-1939");
    System.out.println("1 - 1940-1949");
    System.out.println("1 - 1950-1959");
    System.out.println("1 - 1960-1969");
    System.out.println("1 - 1970-1979");
    System.out.println("1 - 1980-1989");
    System.out.println("1 - 1990-1999");
    System.out.println("1 - 2000-2005");
    
  • first, second, ..., tenth are all of type String. They do not have a method findRank.

I'm sure there's more, but I'm going to stop here. Once you get those sorted out, you'll likely be in prime position to fix the rest.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!