SuzumiyaSAMA 2016-06-22 03:13 采纳率: 92.3%
浏览 1062
已采纳

java错误,至今懵逼,求解

```package code;
import code.User;
import code.Student;
import java.awt.*;

import javax.swing.JOptionPane;

public class DataHandle
{
User[] users = new User[4];
users[0] = new User("Tom","moT");
users[1] = new User("Jeff","ffeJ");
users[2] = new User("Dan","naD");
users[3] = new User("Jerry","yrreJ");
Student[] students = new Student[5];

int count = 0;

boolean CheakName (String name)
{
    for (int count = 0; count < 4; count++)
        if (users[count].getName() == name)
            return true;
    return false;
}   
boolean CheakPassword (String password) 
{
    for (int count = 0; count < 4; count++)
        if (users[count].getPassword() == password)
            return true;
    return false;
}

void RecordIn (int INPUT1, int INPUT2, int INPUT3, int INPUT4, String INPUT5)
{
    if (count == 4)
    {
        JOptionPane.showMessageDialog(null, "The storage is already full");
    }
    students[count] = new Student(INPUT1,INPUT2,INPUT3,INPUT4,INPUT5);
    count++;
}
void sortStudents ()
{
    for (int countO = 0; countO < count-1; countO++)
        for (int countI = countO; countI < count; countI++)
            if (students[countO].getNumber() > students[countI].getNumber())
            {
                Student swap = new Student(students[countI].getNumber(),
                                           students[countI].getChinese(),
                                           students[countI].getEnglish(),
                                           students[countI].getMath(),
                                           students[countI].getName());
                students[countI].setNumber(students[countO].getNumber());
                students[countI].setChinese(students[countO].getChinese());
                students[countI].setEnglish(students[countO].getEnglish());
                students[countI].setMath(students[countO].getMath());
                students[countI].setName(students[countO].getName());
                students[countO].setNumber(swap.getNumber());
                students[countO].setChinese(swap.getChinese());
                students[countO].setEnglish(swap.getEnglish());
                students[countO].setMath(swap.getMath());
                students[countO].setName(swap.getName());
            }
}
Student Serch (int INPUT)
{
    for (int Count = 0; Count < count; Count++)
        if (students[Count].getNumber() == INPUT)
            return students[Count];
    JOptionPane.showMessageDialog(null, "The student is not exsist");
}
Student Serch (String INPUT)
{
    for (int Count = 0; Count < count; Count++)
        if (students[Count].getName() == INPUT)
            return students[Count];
    JOptionPane.showMessageDialog(null, "The student is not exsist");
}

}

错误在第9至17行
错误提示如下:
第9行:Syntax error on token ";", { expected after this token 
第17行:Syntax error, insert "}" to complete Block
  • 写回答

3条回答 默认 最新

  • 林深 2016-06-22 04:30
    关注

    图片说明
    这个地方最后应该也要加个null的返回值吧,然后应该不会出现users数组不存在的情况,你可以再加个public的访问权限试一下

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀