挑错题:A、B、C、D注释标注的哪行代码没有编译错误,但会触发NullPointerException运行异常??import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Win extends JFrame implements ActionListener{JPanel panel;JButton button;public Win() {panel = new JPanel();panel.setLayout(new FlowLayout()); //Aadd(panel); //Bpanel.add(new JLabel("java"));button.addActionListener(this); //Cbutton = new JButton("enter");panel.add(button); //DsetBounds(10,10,460,360);setVisible(true);setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);}public void actionPerformed(ActionEvent e){}public static void main(String args[]) {Win win=new Win();}}
查看答案
挑错题:A、B、C、D注释标注的哪行代码有错误?import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Win extends JFrame implements ItemListener{JCheckBox c;public Win() {c = new JCheckBox("ok");c.setBackground(new Color(12,255,100)); //Ac.addItemListener(this); //Badd(c); //CsetBounds(10,10,460,360);setVisible(true);setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);}public void itemStateChanged(ItemEvent e){JCheckBox box = e.getSource(); //D}}
A
B
C
D
阅读程序题: 给出下列【代码】注释标注的代码的输出结果。import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Win100401 extends JFrame {JCheckBox check;public Win100401() {setLayout(new FlowLayout());check = new JCheckBox("good");check.addItemListener(e->{if(check.isSelected())System.out.println(check.getText());//【代码】});add(check);setBounds(10,10,460,360);setVisible(true);setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);}public static void main(String args[]){new Win();}}
阅读程序题: 当用户在文本框中输入”9“并按回车键时,下列【代码】注释标注的代码的输出结果是什么?import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Win100402 extends JFrame {JTextField text;public Win100402() {setLayout(new FlowLayout());text = new JTextField(8);text.addActionListener((e)->{int m = Integer.parseInt(text.getText());System.out.println(m*m); //【代码】});add(text);setBounds(10,10,460,360);setVisible(true);setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);}public static void main(String args[]){new Win100402();}}
放松性肌电生物反馈疗法主要针对的是
A. 局部持续紧张或痉挛肌肉
B. 全身持续紧张或痉挛
C. 提高肌肉的张力
D. 预防肌肉萎缩
E. 恢复肌力