Java语言使用的字符码集是( )。

A:ASCII B:BCD C:DCB D:Unicode

下列事件__中,无法对TextField对象进行事件监听和处理的是( )。

A:ActionListener B:FocusListener C:MouseMotionListener D:ChangeListener

本题中定义了一个长度为20的整数数组,然后将1~20分别赋给数组元素,计算该数组中所有下标为奇数的元素的和。   public class javal{   public static void main(String args[]){   int sum;    ;   int arrayList[]=new int[20];   for(int i=0;i<=19;i++)   arrayList[i]=i+1;   int pos=0;   while(pos<20){   if( )   sum=sum+arrayList[pos];    ;   }   System.out.println("sum="+sum);   }   }

第1处:sum=0   第2处:pos%2= =1或pos%2 1= =0   第3处:pos++或pos+=1或pos=pos+1

本题的功能是通过按钮来选择窗口显示的风格。窗口中有三个按钮:“Metal”、“Motif”和“Windows”,单击任何一个按钮,就能将窗口的风格改变为按钮名称所对应的风格。   import java.awt.*;   import java.awt.event.*;   import javax.swing.*;   class PlafPanel extends JPanel implements ActionLis-   tener   {public ( )   {metaIButton=new JButton("Metal");   motifButtOn=new J Button("Motif");   windowsButton=new JButton("Windows");   add(metalButton);   add(motifButton);   add(windowsButton);   metalButton.addActionListener(this);   motifButton.addActionListener(this);   windowsButton.addActionListener(this);   }   Dublic void actionPerformed(ActionEvent evt)   {Object source=evt.getSource( );   String plaf="":   if(source= =metalButton)   plaf="javax.swing.plaf.metal.MetalLookAnd-   Feel";   else if(source= =motifButton)   plaf="com.sun.java.swing.plaf.motif.Moti-   fLookAndFeel";   else if(source= =windowsButton)   Dlaf="com.sun.java.swing.plaf.windows.Win-   dowsLookAndFeel";   try   {UIManager.setLookAndFeel( );   SwingUtilities.updateComponentTreeUI(this);   }   catch(Exception e){)   }   private JButton metalButton;   private JButton motifButton;   private JButton windowsButton;   }   class PlafFrame extends JFrame   {public PlafFrame( )   { setTitle("simple");   setSize(300,200);   addWindowListener(new WindowAdapter( )   {public void windowClosing(WindowEvent e)   {System.exit(O);   }   });   Container contentPane=getContentPane( );   contentPane.add(new PlafPanel( ));   }   }   public class java2   {public static void main(String[]args)   f JFrame frame=new PlafFrame( );   frame.show( );   }

第1处:PlafPanel   第2处:plaf

本程序的功能是获取文本框中的文本。窗口中有两个文本框“用户名”和“密码”,以及三个按钮“登录”、“其他用户登录,,和“关闭”,初始状态“用户名”文本框是只读的,单击“其他用户登录”按钮后变成可写的,“密码”文本框使用的不是密码文本框,在用户键入的时候设置显示为*号。输入用户名和密码后,单击“登录”按钮后,如果输入的密码为空,则弹出提示消息框,否则后台将显示输入的用户名和密码。比如显示为“admin用户的密码:password”(admi为输入的用户名,password为输入密码)。   import java.awt.*;   import java.awt.event.*;   import javax.swing.JOptionPane;   public class java3   {   public static void main(String args[])   {   final Frame frmFrame=new Frame( );   Panel pnlPanel=new Panel( );   Label lblUsername=new Label("用户名");   Label lblPassword=new Label("密码");   final TextField txtUsername=new TextField("   Student");   final TextField txtPassword=new TextFidd("",   8);   txtUsername.setEditable(false);   txtPassword.setChar(’*’);   Button btnButtonl=new Button("登录");   ButtOn btnButton2=new Button("其他用户登   录");   Button btnButton3=new Button("关闭");   btnButtonl.addActionListener(new ActionListen-er( )   {   public void actionPerformed(ActionEvent e)   {   if((txtPassword.getText( )).length( )= =0)   {   JOptionPane.showMessageDialog(frmFrame,"密码不能为空");   return;   }   txtPassword.setColumns(16);   System.out.println(txtUsername.getText( )+"   用户的密码:"   +txtPassword.getPassword( ));   }   });   btnButton2.addActionListener(new ActionListen-er( )   {   public void actionPerformed(ActionEvent e)   {   txtUsername.setEnable(true);   }   });   btnButton3.addActionListener(new ActionListen-er( )   {   public void actionPerformed(ActionEvent e)   {   System.exit(0);   }   });   pnlPanel.add(1blUsername);   pnlPanel.add(txtUsername);   pnlPanel.add(1blPassword);   pnlPanel.add(txtPassword);   pnlPanel.add(btnButtonl);   pnlPanel.add(btnButton2);   pnlPanel.add(btnButton3);   frmFrame.add(pnlPanel);   frmFrame.setTitle("advance");   frmFrame.pack( );   frmFrame.show( );   }   }

第1处:txtPassWord.setEchoCharf(’*’)   第2处:txtPassword.getText()   第3处:txtUsername.setEditable(true)

下列叙述中正确的是( )。

A:一个算法的空间复杂度大,则其时间复杂度必定大 B:一个算法的空间复杂度大,则其时间复杂度必定小 C:一个算法的时间复杂度大,则其空间复杂度必定小 D:上述3种说法都不对

开发软件时对提高开发人员工作效率至关重要的是( )。

A:操作系统的资源管理功能 B:先进的软件开发工具和环境 C:程序员的数量 D:计算机的并行处理能力

程序设计语言的基本成分是数据成分、运算成分、控制成分和( )。

A:对象成分 B:变量成分 C:语句成分 D:传输成分

对长度为n的线性表进行顺序查找,在最坏情况下需要比较的次数为( )。

A:125 B:n/2 C:n D:n+l

有下列二叉树,对此二叉树前序遍历的结果为()。

A:XZCYAB B:XYZABC C:XYABCZ D:XYAZBC

微信扫码获取答案解析
下载APP查看答案解析