判断题 住房市场存在政府干预且受社会高度关注,除政府政策调整、社会舆论导向等的影响外,示范效应、从众心理等也会影响购买者决策,出现羊群效应等非理性购买行为。( )
问答题 本题中定义了长度为20的一维整型数组a,并将数组元素的下标值赋给数组元素,最后打印输出数组中下标为奇数的元素。 public class javal{ public static void main(String[]args){ int a[]= ; int i; for( ;i++) a[i]=i; for(i=0;i<20;i++){ if( ) System.OUt.print("a[It+i+"]="+a[i]+","); } } }
问答题 本题的功能是监听键盘键的敲击,并显示在窗口中。 import javax,.swing.*; importjava.awt.*; , import java.awt.event.*; public class java3 extends JFrame extends KeyListener { private String linel=""line2="" private String line3="" private JTextArea textArea; public java3() { super("java3"); textArea=new JTextArea(10,15); textArea.setText("Press any key on the key- board…"); textArea.setEnabled(false); addKeyListener(this); getContentPane().add(textArea); setSize(350,100); show(); } public void keyPressed(KeyEvent e) { linel="Key pressed:"+e.getKeyText(e. getKeyCode()); setLines2and3(e); } public void keyReleased(KeyEvent e) { linel="Key released:"+e.getKeyText(e. getKeyCode()); setLines2and3(e): } public void keyTyped(KeyEvent e) { Linel="Key typed:"+e.getKeychar(); setLines2and3(e); } private void setLines2and3(KeyEvent e) { line2="This key is"+(e.isActionKey()?"" :"not")+"an action key"; String temp=e.getKeyModifiersText(e.get- Modifiers()); hne3="Modifier keys pressed:"+(temp.e- quals("")?"none":temp); textArea.setText(linel+"\n"+line2+"\n" +line3+"\n"); } public static void main(String args[]) { java3 app=new java3(); addWindowListener(new Windowadapted() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } }