小编use*_*272的帖子

类预期错误.需要帮助简单的程序

当我运行这个程序时,我得到这些错误:

Testscore.java:26: class expected
           grade = double.parseDouble(strInput);
                          ^
Testscore.java:26: ';' expected
           grade = double.parseDouble(strInput);
                                     ^
Testscore.java:26: not a statement
           grade = double.parseDouble(strInput);
                                      ^
Testscore.java:26: ';' expected
           grade = double.parseDouble(strInput);
                                              ^
4 errors
Run Code Online (Sandbox Code Playgroud)

我有double.parseDouble(strInput);正确的吗?

import javax.swing.*;
import java.lang.IllegalArgumentException;

public class Testscore
{
   public static void main(String[] args) 
    {
       int numberofTests = 0;

       double grade = new double[numberofTests];

       double startgrade = 0;

       String strInput;

    // Get how many tests are used

       strInput = JOptionPane.showInputDialog(null, "How many tests do you have? …
Run Code Online (Sandbox Code Playgroud)

java loops

0
推荐指数
1
解决办法
1502
查看次数

Java程序不会编译

我正在jgrasp下制作这个程序而且我收到了一个错误.我检查了我的程序的拼写和语法,似乎是正确的.请帮助我 - 是否有一些我错过的导致我所有错误的东西?

import javax.swing.*;


public class Testscore
{
   public static void main(String[] args) 
    {
       int numberofTests = 0;

       double grade = new double[numberofTests];

       double startgrade = 0;

        int x = 1 ;

       String strInput;

    // Get how many tests are used

       strInput = JOptionPane.showInputDialog(null, "How many tests do you have? ");
       numberofTests = Integer.parseInt(strInput);

       grade = new double[(int) numberofTests];
         do

         {

       for (int index = 0; index < grade.length; index++)
       {
           strInput = JOptionPane.showInputDialog(null, "Enter Test Score." + (index …
Run Code Online (Sandbox Code Playgroud)

java

-1
推荐指数
1
解决办法
2145
查看次数

标签 统计

java ×2

loops ×1