【发布时间】:2014-08-15 16:23:25
【问题描述】:
我是一名计算机科学专业的学生,刚刚进入真正的面向对象编程领域,我假设我的问题与对初始化对象的理解不够好有关。
我得到了必须处理读取/写入文件的作业,我可以很好地处理,如果我能够编写自己的 main 方法,并且从头开始,我觉得我可以在不到一分钟的时间内完成然而,一个小时......在家庭作业中,我们上了一门我们不能改变的主课。他还给了我另一种开始的方法。它们如下:
import java.io.*;
import java.util.*;
public class CSCD211Lab1
{
private static final int TEAMS = 32;
public static void main(String [] args)throws Exception
{
int choice;
Scanner kb = new Scanner(System.in);
Team [] worldCupTeams = null;
worldCupTeams = fillTeamsArray(kb);
do
{
choice = menu(kb);
executeChoice(choice, worldCupTeams);
}while (choice != 8);
}// end main
public static Team [] fillTeamsArray(Scanner kb)throws Exception
{
return null;
}// end fillTeamArray
public static Player [] readPlayers(String filename)throws Exception
{
return null;
}// end readPlayers
public static int menu(Scanner kb)
{
/*
1. Print all Teams to the screen
2. Print all Teams to the User Specified file
3. Sort the Teams by “Natural Order” (Hint: compareTo)
4. Sort the by Team Country Name (Hint: Comparator)
5. Sort each Team's Players by Number (Hint: Player compareTo)
6. Sort each Team's Players by Position (Hint: Comparator)
7. Print a entire team and only that team to a user specified file
8. Quit
*/
return 8;
}// end menu
public static void executeChoice(int choice, Team [] array)throws Exception
{
}// end executeChoice
public static void printArray(PrintStream out, Team [] array)
{
}// end printArray
}// end class
我的问题是为什么这会导致 public static Team [] fillTeamsArray 出现“找不到符号”错误?我假设我需要在 fillTeamsArray 中对其进行一些定义,但任何时候我尝试都会遇到同样的错误。我不是在找人来做我的功课,我只是在寻找朝着正确方向前进的动力。我转到了学校,而我已经完成的先决条件肯定没有涵盖它应该具备的一点材料。
感谢任何帮助! 谢谢!
【问题讨论】:
-
请向我们展示完整的编译错误信息。
-
Team课程是给你的吗?还是一定要写?
标签: java arrays oop object symbols