当前位置: 技术问答>java相关
访问一个JButton数组时,出现 NullPointerException ,请帮忙 (附程序)
来源: 互联网 发布时间:2015-09-14
本文导语: 简化后的程序(报错依旧)如下: /*-----------------------------------------------*/ import java.awt.*; import javax.swing.*; public class Test { public static void main(String args[]) { JButton buttonOperand[]=new JButton[11]; ...
简化后的程序(报错依旧)如下:
/*-----------------------------------------------*/
import java.awt.*;
import javax.swing.*;
public class Test
{
public static void main(String args[])
{
JButton buttonOperand[]=new JButton[11];
//操作数按钮:0~9 和小数点 .
String strOperandFig[]={"0","1","2","3","4","5","6","7","8","9","."};
for( int i=0; i
/*-----------------------------------------------*/
import java.awt.*;
import javax.swing.*;
public class Test
{
public static void main(String args[])
{
JButton buttonOperand[]=new JButton[11];
//操作数按钮:0~9 和小数点 .
String strOperandFig[]={"0","1","2","3","4","5","6","7","8","9","."};
for( int i=0; i