⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scjp-1.htm

📁 详细介绍scjp考试指南包括基础语法和文件读取
💻 HTM
📖 第 1 页 / 共 5 页
字号:
          <TD vAlign=center><FONT face=Courier>Thread t = new 
            Thread(targetObject);</FONT></TD></TR></TBODY></TABLE>What test of <FONT 
      face=Courier>instanceof</FONT> does <FONT face=Courier>targetObject</FONT> 
      have to pass for this to be legal? 
      <P>Select the one right answer. 
      <P>
      <OL type=a>
        <LI><FONT face=Courier>targetObject instanceof Thread</FONT> 
        <LI><FONT face=Courier>targetObject instanceof Object</FONT> 
        <LI><FONT face=Courier>targetObject instanceof Applet</FONT> 
        <LI><FONT face=Courier>targetObject instanceof Runnable</FONT> 
        <LI><FONT face=Courier>targetObject instanceof String</FONT> </LI></OL>
      <P>
      <P><B>Question 47</B>: What appears in the standard output when you run 
      the Dots class? 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>class Dots implements Runnable 
            {</FONT> 
            <DIR><FONT face=Courier>DotThread t;</FONT> 
            <P><FONT face=Courier>public static void main(String[] args) 
            {</FONT> 
            <DIR><FONT face=Courier>Dots d = new Dots();</FONT> 
            <P><FONT face=Courier>d.t = new DotThread();</FONT></P></DIR><FONT 
            face=Courier>}</FONT> 
            <P><FONT face=Courier>public void init() {</FONT> 
            <DIR><FONT face=Courier>t.start();</FONT> 
            <P><FONT face=Courier>t = new 
            DashThread().start();</FONT></P></DIR><FONT 
            face=Courier>}</FONT></DIR><FONT face=Courier>}</FONT> 
            <P><FONT face=Courier></FONT> 
            <P><FONT face=Courier>class DotThread extends Thread {</FONT> 
            <DIR><FONT face=Courier>public void run() {</FONT> 
            <DIR><FONT face=Courier>for (int index = 0; index &lt; 100; 
            index++)&nbsp;</FONT> 
            <DIR><FONT 
            face=Courier>System.out.print(".");</FONT></DIR></DIR><FONT 
            face=Courier>}</FONT></DIR><FONT face=Courier>}</FONT> 
            <P><FONT face=Courier>class DashThread extends Thread {</FONT> 
            <DIR><FONT face=Courier>public void run() {</FONT> 
            <DIR><FONT face=Courier>for (int index = 0; index &lt; 100; 
            index++)&nbsp;</FONT> 
            <DIR><FONT 
            face=Courier>System.out.print("-");</FONT></DIR></DIR><FONT 
            face=Courier>}</FONT></DIR><FONT 
      face=Courier>}</FONT></TD></TR></TBODY></TABLE>
      <OL type=a>
        <LI>nothing 
        <LI>100 dots (.) 
        <LI>200 dots (.) 
        <LI>100 dashes (-) 
        <LI>100 dots (.) and 100 dashes(-) </LI></OL>
      <P><B>Question 48</B>: When you invoke <FONT face=Courier>repaint()</FONT> 
      for a Component, the AWT package calls which Component method? 
      <P>
      <OL type=a>
        <LI><FONT face=Courier>repaint()</FONT> 
        <LI><FONT face=Courier>update()</FONT> 
        <LI><FONT face=Courier>paint()</FONT> 
        <LI><FONT face=Courier>draw()</FONT> 
        <LI><FONT face=Courier>show()</FONT> </LI></OL>
      <P><B>Question 49</B>: How you can you test whether an object referenced 
      by <FONT face=Courier>ref</FONT> implements an interface named 
      MyInterface? Replace <FONT face=Courier>your test here</FONT> with this 
      test: 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>if (your test here) {</FONT> 
            <DIR><FONT face=Courier>System.out.println("ref implements 
            MyInterface");</FONT></DIR></TD></TR></TBODY></TABLE>Fill in the blank. 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT 
      face=Courier>&nbsp;</FONT></TD></TR></TBODY></TABLE><B>Question 50</B>: 
      What does the following line of code do? 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>TextField tf = new 
            TextField(30);</FONT></TD></TR></TBODY></TABLE>Select the one right 
      answer. 
      <P>
      <OL type=a>
        <LI>This code is illegal; there is no such constructor for TextField. 
        <LI>Creates a TextField object that can hold 30 rows, but since it is 
        not initialized to anything, it will always be empty. 
        <LI>Creates a TextField object that can hold 30 columns, but since it is 
        not initialized to anything, it will always be empty. 
        <LI>This code creates a TextField object that can hold 30 rows of text. 
        <LI>Creates a new TextField object that is 30 columns of text. </LI></OL>
      <P><B>Question 51</B>: Given these code snippets: 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>Boolean b1 = new 
            Boolean(true);</FONT> 
            <P><FONT face=Courier>Boolean b2 = new 
        Boolean(true);</FONT></P></TD></TR></TBODY></TABLE>Which expressions are 
      legal Java expressions that return <FONT face=Courier>true</FONT>? 
      <P>Select all valid answers. 
      <P>
      <OL type=a>
        <LI><FONT face=Courier>b1 == b2</FONT> 
        <LI><FONT face=Courier>b1.equals(b2)</FONT> 
        <LI><FONT face=Courier>b1 &amp; b2</FONT> 
        <LI><FONT face=Courier>b1 | b2</FONT> 
        <LI><FONT face=Courier>b1 &amp;&amp; b2</FONT> 
        <LI><FONT face=Courier>b1 || b2</FONT> </LI></OL>
      <P><B>Question 52</B>: Which LayoutManager arranges components left to 
      right, then top to bottom, centering each row as it moves to the next? 
      <P>Select the one right answer. 
      <P>
      <OL type=a>
        <LI>BorderLayout 
        <LI>FlowLayout 
        <LI>GridLayout 
        <LI>CardLayout 
        <LI>GridBagLayout </LI></OL>
      <P>
      <P><B>Question 53</B>: A component can be resized horizontally, but not 
      vertically, when it is placed in which region of a BorderLayout? 
      <P>Select the one right answer. 
      <P>
      <OL type=a>
        <LI>North or South 
        <LI>East or West 
        <LI>Center 
        <LI>North, South, or Center 
        <LI>any region </LI></OL>
      <P>
      <P><B>Question 54</B>: How can you place three Components along the bottom 
      of a Container? 
      <P>Select the one right answer. 
      <P>
      <OL type=a>
        <LI>Set the Container's LayoutManager to be a BorderLayout and add each 
        Component to the "South" of the Container . 
        <LI>Set the Container's LayoutManager to be a FlowLayout and add each 
        Component to the Container. 
        <LI>Set the Container's LayoutManager to be a BorderLayout; add each 
        Component to a different Container that uses a FlowLayout, and then add 
        that Container to the "South" of the first Container. 
        <LI>Use a GridLayout for the Container and add each Component to the 
        Container. 
        <LI>Do not use a LayoutManager at all and add each Component to the 
        Container. </LI></OL>
      <P>
      <P><B>Question 55</B>: What will happen when you attempt to compile and 
      run the following program by passing the Test class to the Java 
      interpreter? 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>class Test {</FONT> 
            <DIR><FONT face=Courier>public static void main() {</FONT> 
            <DIR><FONT 
            face=Courier>System.out.println("hello");</FONT></DIR><FONT 
            face=Courier>}</FONT></DIR><FONT 
      face=Courier>}</FONT></TD></TR></TBODY></TABLE>Select the one right 
      answer. 
      <P> 
      <P>
      <OL type=a>
        <LI>The program does not compile because <FONT 
        face=Courier>main()</FONT> is not defined correctly. 
        <LI>The program compiles but when you try to run the interpreter 
        complains that it cannot find the <FONT face=Courier>main()</FONT> 
        method it needs to run. 
        <LI>The program compiles but you cannot run it because the class is not 
        declared as <FONT face=Courier>public</FONT>. 
        <LI>The program compiles and runs without an error but does not display 
        anything in the standard output. 
        <LI>The program compiles and displays "hello" in the standard output 
        when you run it. </LI></OL>
      <P>
      <P><B>Question 56</B>: Which of the following is a valid way to embed an 
      applet class named Q56 into a Web page? 
      <P>Select all right answers. 
      <P>a) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>&lt;applet class=Q56.class 
            width=100 height=100&gt;&nbsp;</FONT> 
            <P><FONT 
      face=Courier>&lt;/applet&gt;</FONT></P></TD></TR></TBODY></TABLE>b) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>&lt;applet code=Q56 width=100 
            height=100&gt;&nbsp;</FONT> 
            <P><FONT 
      face=Courier>&lt;/applet&gt;</FONT></P></TD></TR></TBODY></TABLE>c) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>&lt;applet code=Q56.class 
            width=100 height=100&gt;&nbsp;</FONT> 
            <P><FONT 
      face=Courier>&lt;/applet&gt;</FONT></P></TD></TR></TBODY></TABLE>d) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>&lt;applet param=Q56.class 
            width=100 height=100&gt;&nbsp;</FONT> 
            <P><FONT 
      face=Courier>&lt;/applet&gt;</FONT></P></TD></TR></TBODY></TABLE>e) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>&lt;applet param=Q56 width=100 
            height=100&gt;&nbsp;</FONT> 
            <P><FONT 
      face=Courier>&lt;/applet&gt;</FONT></P></TD></TR></TBODY></TABLE><B>Question 
      57</B>: How would you make the background color red for a Panel referenced 
      by the variable <FONT face=Courier>p</FONT>? 
      <P>Fill in the blank. 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT 
      face=Courier>&nbsp;</FONT></TD></TR></TBODY></TABLE><B>Question 58</B>: 
      How can you retrieve a circle抯 radius value that抯 passed to an applet? 
      <P>a) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>public void init() {</FONT> 
            <DIR><FONT face=Courier>String s = getParameter("radius");</FONT> 
            <P><FONT 
            face=Courier>doSomethingWithRadius(s);</FONT></P></DIR><FONT 
            face=Courier>}</FONT></TD></TR></TBODY></TABLE>b) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>public static void 
            main(String[] args) {</FONT> 
            <DIR><FONT face=Courier>String s = args[0];</FONT> 
            <P><FONT 
            face=Courier>DoSomethingWithRadius(s);</FONT></P></DIR><FONT 
            face=Courier>}</FONT></TD></TR></TBODY></TABLE>c) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>public static void 
            main(String[] args) {</FONT> 
            <DIR><FONT face=Courier>String s = getParameter("radius");</FONT> 
            <P><FONT 
            face=Courier>DoSomethingWithRadius(s);</FONT></P></DIR><FONT 
            face=Courier>}</FONT></TD></TR></TBODY></TABLE>d) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>public void init() {</FONT> 
            <DIR><FONT face=Courier>int radius = getParameter("radius");</FONT> 
            <P><FONT 
            face=Courier>doSomethingWithRadius(radius);</FONT></P></DIR><FONT 
            face=Courier>}</FONT></TD></TR></TBODY></TABLE>e) 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
          <TD vAlign=center><FONT face=Courier>public void init() {</FONT> 
            <DIR><FONT face=Courier>int radius = getParameter();</FONT> 
            <P><FONT 
            face=Courier>doSomethingWithRadius(radius);</FONT></P></DIR><FONT 
            face=Courier>}</FONT></TD></TR></TBODY></TABLE>
      <P><B>Question 59</B>: What is the result of invoking <FONT 
      face=Courier>main()</FONT> for the classes D and E? 
      <TABLE width="100%" border=1>
        <TBODY>
        <TR>
      

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -