Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
这个程序可以在其他计算机上运行,但在我的计算机上,它显示null(java)_Java_Netbeans_Hashmap_Token - Fatal编程技术网

这个程序可以在其他计算机上运行,但在我的计算机上,它显示null(java)

这个程序可以在其他计算机上运行,但在我的计算机上,它显示null(java),java,netbeans,hashmap,token,Java,Netbeans,Hashmap,Token,我有一个程序可以在我朋友和我们的电脑实验室的电脑上正常工作,但在我的电脑上不工作。它由令牌和数组组成 @Override public void actionPerformed(ActionEvent e) { String sentence = msgBox.getText(); String word=""; StringTokenizer token = new StringTokenizer(sentence, " "); while(token.hasM

我有一个程序可以在我朋友和我们的电脑实验室的电脑上正常工作,但在我的电脑上不工作。它由令牌和数组组成

@Override
public void actionPerformed(ActionEvent e) {
    String sentence = msgBox.getText();
    String word="";
    StringTokenizer token = new StringTokenizer(sentence, " ");
    while(token.hasMoreTokens()){
        word = token.nextToken();
        if(pronoun.containsKey(word)){
           outputBox.setText(outputBox.getText()+word+" = "+pronoun.get(word)+"\n");  
        }
        else if(verb.containsKey(word)){
           outputBox.setText(outputBox.getText()+word+" = "+verb.get(word)+"\n");  
        }
        else if(adjective.containsKey(word)){
           outputBox.setText(outputBox.getText()+word+" = "+adjective.get(word)+"\n");  
        }
    }
我已经尝试重新安装netbeans,但它在输出上仍然显示null。请帮忙

get(word)获取此部分,因为每个部分都有其数组:

for(int i=0; i<pronounArray.length; i++)
        pronoun.put(pronounArray[i], "Pronoun");
    for(int i=0; i<verbArray.length; i++)
        pronoun.put(verbArray[i], "Verb");
    for(int i=0; i<adjectiveArray.length; i++)
        pronoun.put(adjectiveArray[i], "Adjective");

用于(int i=0;i您是否尝试过使用调试器?这不太可能是Netbeans安装问题。这很可能是您的程序中的错误,或者是您安装或运行它的方式存在一些差异。您编写的代码将
代词数组
verbArray
形容词数组
添加到
代词映射,将
动词
形容词
映射留空。怀疑在它工作的机器上缺少重新编译。唯一有趣的问题是,这段代码是如何在你朋友的计算机上“工作”的。它应该永远不会在任何地方工作……有那个bug。