简体   繁体   English

我的课程可以编译,但无法正常运行! (BlueJ)

[英]My class compiles but will not run correctly! (BlueJ)

Okay so I will put in my code below this but let me explain. 好的,所以我将代码放在下面,但让我解释一下。 I am trying to find the value of vals[2][1]. 我试图找到vals [2] [1]的值。 But when I type in my code, it compiles, I hit void main(String[] args), but then nothing happens. 但是,当我键入代码时,它会编译,然后击中void main(String [] args),但随后什么也没有发生。 It does not say error, it does not pop up a window. 它没有说错误,也没有弹出窗口。 Why? 为什么?

public class New
{
    public static void main(String[] args){

       double[][] vals = {{1.1, 1.3, 1.5},
                                 {3.1, 3.3, 3.5},
                                 {5.1, 5.3, 5.5},
                                 {7.1, 7.3, 7.5}};
                                }
    }

In Java, you actually need to write code to produce output. 在Java中,您实际上需要编写代码以产生输出。

For example, to print the value of vals[2][1] ... add this: 例如,要打印vals[2][1] ...的值,请添加以下内容:

System.out.println(vals[2][1]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM