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

📄 tt.html

📁 详细介绍scjp考试指南包括基础语法和文件读取
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<HTML>
<HEAD>
<title>SCJP模拟题03(转贴) --JQuest (90道) </title>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<style type=text/css>
a:link {COLOR: #000000; TEXT-DECORATION: none}
a:visited {COLOR: #808080;TEXT-DECORATION: none}
a:hover { color: #FF0000}
a:active { color: #6699ff}

a.h1{ color: #000000; text-decoration: none;font-size: 9pt}
a.h1:link { color: #000000; text-decoration: none;font-size: 9pt}
a.h1:visited { color: #000000; text-decoration: none;font-size: 9pt}
a.h1:active { color: #FF0000; text-decoration: underline;font-size: 9pt}
a.h1:hover { color: #FF0000; text-decoration: underline;font-size: 9pt}

a.h2{ color: #000000; text-decoration: none}
a.h2:link { color: #000000; text-decoration: none}
a.h2:visited { color: #000000; text-decoration: none}
a.h2:active { color: #FF0000; text-decoration: underline}
a.h2:hover { color: #FF0000; text-decoration: underline}


/*抬头*/
.t1 { font-size: 12.8px; letter-spacing: 1px; font-family: "宋体"; filter: Glow(Color=#ffffff, Strength=1)}
.t2 { line-height: 150%; font-size: 10.5pt}
.t3 { letter-spacing: 1px; font-family: "宋体";font-size: 10.5pt; border-color: white #57542b #57542b white; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
.t4 { font-size: 10.5pt}

/*内容*/
.c1 { font-size: 12.8px}
.c2 { font-size: 14.8px}

/*控制段落长度*/
.l1 { line-height: 119%}
.l2 { line-height: 150%}

/*总体规划*/
.button01 { font-size: 9pt; border-color: black black #000000; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
td { font-family: "宋体"; font-size: 10.5pt}
br { font-size: 5px}
form { font-size: 9pt}
.bbs{ line-height: 150%; font-size: 12px}
		.Gen {
		POSITION: relative
		}
		
		.heading {
		BACKGROUND: lightgrey; COLOR: navy
		}
		.mytext {
		BACKGROUND-COLOR: #ffffff; POSITION: relative
		}
		.TBGen {
		FONT: 8pt verdana,arial,sans-serif; HEIGHT: 22px; POSITION: absolute; TOP: 2px
		}
		TD.t2 {
			font-size: 12px;BACKGROUND-COLOR: buttonface;
		}
		select {
	               FONT: 8pt verdana,arial,sans-serif;
	        }
</style>
<script language="JavaScript">
		<!--
		function MenuClick(name)
		{
		if (name.style.display=="none")
		name.style.display="";
		else
		name.style.display="none";
		}
		//-->
		</script>
</HEAD>
<body bgcolor=#FFEEFF background="http://" link="#000000" vLink="#808080" topmargin="0">
<script language="JavaScript">
<!--
document.cookie="session=XhEnVfClHq;path=/;";
function MM_openBrWindow(theURL){
window.open(theURL,'','width=480,height=490');
}
function tomail(str){
message = '请输入Email地址:';
temp =prompt(message, '');
if (temp == null){
		return;
}
else {
	this.location = 'tomail?forum=javastudy&message='+str+'&email='+temp;
}
}
function tobbs(){
message = '请输入将要转移的bbs英文代号:';
temp =prompt(message, '');
if (temp == null){
return;
}
else {
document.tobbsform.tobbs.value = temp;
document.tobbsform.submit();
}
}
var tim=0
function viewscreen(){
if (tim==0){
	tim=1;
	parent.bbstop.rows='0%,*';
	document.all.Style3.style.display = "";
	document.all.Style4.style.display = "none";
}
else{
	parent.bbstop.rows='60%,*';
	document.all.Style3.style.display = "none";
	document.all.Style4.style.display = "";
	tim=0;}
}
function delit(str){
	var message;
	message = '注意:您是否要删除此贴?';
	if (!confirm(message)) {
	return;
	}
	this.location = 'del?forum=javastudy&message='+str;
	return;
}
//-->
</script>
<script language="JavaScript">
<!--
function mOvr(src) { if (!src.contains(event.fromElement)) { src.style.cursor = 'hand';}}
function mOut(src) { if (!src.contains(event.toElement)) { src.style.cursor = 'default';}}
function showshow(name)
{
if (name.style.display=="block")
{
name.style.display="none";
 showlayer.show.value="打开社区秀";
}
else
{
name.style.display="block";
 showlayer.show.value="关闭社区秀";
}
}
function bbimg(o){
var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
return false;
} 
// -->
</script>
<form name="tobbsform" action="tobbs" method="post" target="bbsview">
<input type="hidden" name="forum" value="javastudy">
<input type="hidden" name="tobbs" value="">
<input type="hidden" name="message" value="156">
</form>
<form name="sendform">
<input type="hidden" name="author" value="chairyuan">
<input type="hidden" name="body" value="(http://javastudy.bbs.xilu.com)SCJP模拟题03(转贴) --JQuest (90道)比较平均的一套题,适合于在大略看 ">
</form>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr> 
<td width="12"><img src="/img/bbs/leike_xl_sq_01.gif" width="12" height="22"></td>
<td align="center" background="/img/bbs/leike_xl_sq_03_bg.gif"> 
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="22">
<tr align="center"> 
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td width="1%" rowspan="2" valign="top"><img height=16 
src="/img/bbs/leike_xl_sq_04_li.gif" width=14 
border=0></td>
<td valign="bottom" height=4><spacer type="block" width=1   height=1></td>
</tr>
<tr>
<td valign="bottom">
<div id=Style4><a class=h1 href="javascript:viewscreen();">全屏</a></div>
<div id=Style3 style="DISPLAY: none"><a class=h1 href="javascript:viewscreen();">半屏</a></div>
</td>
</tr>
</table>
</td>
<td><img src="http://bbs.xilu.com/bbs/mobile.gif" width="14" height="14" border="0"><a href="#" onClick="MM_openBrWindow('/tools/bbssms.html')" title=将该贴转发到对方手机 class=h1><font color=red>短信推荐</font></a></td>
<td><img src="/img/bbs/leike_xl_sq_04_li.gif" width="14" height="16" border="0"><a href="javascript:tobbs();" title=将该贴转向其他版 class=h1>转移</a></td>
<td><img src="/img/bbs/leike_xl_sq_04_li.gif" width="14" height="16" border="0"><a href="javascript:tomail('156');" title=将该贴发往E-Mail class=h1>打包</a></td>
<td><img src="/img/bbs/leike_xl_sq_04_li.gif" width="14" height="16" border="0"><a href="postform?forum=javastudy&message=new" title=发布新贴子 class=h1>发贴</a> </td>
<td><a href=http://x.xilu.com/ target=_blank><img alt="进入西陆X情人" src=http://bbs.xilu.com/ads/xlove.gif border="0"></a></td>
<td><img src="/img/bbs/leike_xl_sq_04_li.gif" width="14" height="16" border="0"><a href="postform?forum=javastudy&message=156" title=回复这个贴子 class=h1>回复</a> </td>
<td><img src="/img/bbs/leike_xl_sq_04_li.gif" width="14" height="16" border="0"><a href="getgoodbbs?forum=javastudy&message=156" class=h1>精品收藏</a></td>
<td><img src="/img/bbs/leike_xl_sq_04_li.gif" width="14" height="16" border="0"><a href="javascript:delit('156');" title=将该贴删除 class=h1>删除</a></td>
<td><img src="/img/bbs/leike_xl_sq_04_li.gif" width="14" height="16" border="0"><a href="modifynote?forum=javastudy&message=156" class=h1>修改</a></td>
<td><img src="/img/bbs/leike_xl_sq_04_li.gif" width="14" height="16" border="0"><a href="addreplytop?forum=javastudy&message=156" title=将该帖在论坛置顶显示 class=h1>置顶</a></td>
<td><img src="/img/bbs/leike_xl_sq_04_li.gif" width="14" height="16" border="0"><a href="http://bbs.xilu.com/bbs/mainfreebbs.html" target=_blank title=申请您的BBS class=h1><font color=red>申请BBS</font></a></td>
</tr>
</table>
</td>
<td width="11"><img src="/img/bbs/leike_xl_sq_02.gif" width="11" height="22"></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr> 
<td width="3%" valign=top><img height=15 src="/img/bbs/mood1.gif" width=15> </td>
<td width="97%"><b>SCJP模拟题03(转贴) --JQuest (90道)</b></td>
</tr>
</table>
<table width="98%" border="1"  bgcolor="#" bordercolorlight="#57542b" bordercolor="#ffffff" cellpadding="0" cellspacing="0" align=center>
<tr> 
<td height=13 width="63%">作者:<a href="http://bbs.xilu.com/cgi-bin/tools/passmail?nick=chairyuan" target=_blank title="单击给他发信"><font color=#000000>chairyuan</font></a><span style="font-family: 宋体; font-size: 9pt">(<a href="bbsip?forum=javastudy&message=156" title="点击这里,版主可以察看IP."><font color=#000000>xxx.xxx.xxx.xxx</font></a>)</span> 
2001/04/20 09:30</td>
<td height=13width="37%">&nbsp;&nbsp;字节:49K  点击:1348次 帖号:156</td>
</tr>
</table>
<table width="98%" border="1"  bgcolor="#" bordercolorlight="#57542b" bordercolor="#ffffff" cellpadding="0" cellspacing="0" align="center">
<tr> 
<td height=13 width="50%">当前论坛: <a href=http://javastudy.bbs.xilu.com target=_blank class=h1>Java初学者论坛  [javastudy.bbs.xilu.com]</a><a href=# onclick=javascript:window.open('/cgi-bin/bbs/registsms?etitle=javastudy','','width=400,height=300')><img border=0 src=http://bbs.xilu.com/ads/regsms.gif alt="订阅论坛短信"></a>
</td>
<td height=13 width="50%">&nbsp;互换联接:<a href=http://021526.bbs.xilu.com target=_blank class=h1><font color=red>你身边的“第七件事” </font></a></td></tr>
</table>
<br>
<table width="98%" border="0" align="center"><tr><td>
<table align=right><tr><td><iframe frameborder=0 leftmargin=0 marginheight=0 marginwidth=0 scrolling=no  topmargin=0 width=350 height=220 src="http://ads.xilu.com/cgi-bin/ads/flashads_new"></iframe></td></tr></table>
比较平均的一套题,适合于在大略看完一遍书之后作,挑出自己的薄弱环节,以便进一步复习。
<br><br>

<br><br>

<br><br>

<br><br>
Q1 
<br><br>
Here is part of the code for a class which implements the Runnable interface.
<br><br>

<br><br>
 1.   public class Whiffler extends Object implements Runnable {
<br><br>
 2.     Thread myT ;
<br><br>
 3.     public void start(){
<br><br>
 4.        myT = new Thread( this );
<br><br>
 5.     }
<br><br>

<br><br>
 6.     public void run(){
<br><br>
 7.        while( true ){
<br><br>
 8.           doStuff();
<br><br>
 9.     }
<br><br>

<br><br>
10.     System.out.println("Exiting run");
<br><br>
11.   }
<br><br>
12.   // more class code
<br><br>

<br><br>
Assume that the rest of the class defines doStuff, etc and that the class compiles without error. Also assume that a Java application creates a Whiffler object and calls the Whiffler start method, that no other direct calls to Whiffler methods are made an that the Thread in this object is the only one the application creates. Which of the following are correct statements ?
<br><br>

<br><br>
a. The doStuff method will be called repeatedly.
<br><br>
b. The doStuff method will never be executed.
<br><br>
c. The doStuff method will execute at least one time.
<br><br>
d. The statement in line 10 will never be reached.
<br><br>

<br><br>
Q2
<br><br>
Here is a method which creates a number of String objects in the course of printing a count down sequence.
<br><br>

<br><br>
1.   public void countDown() {
<br><br>
2.      for( int i = 10 ; i >= 0 ; i-- ){
<br><br>
3.         String tmp = Integer.toString( i );
<br><br>
4.         System.out.println( tmp );
<br><br>
5.      }
<br><br>

<br><br>
6.      System.out.println("BOOM!");
<br><br>
7.   }
<br><br>

<br><br>
When the program reaches line 6, how many of the String objects created in line 3 are eligible for garbage collection? Assume that the System.out object is not keeping a reference.
<br><br>

<br><br>
a. none
<br><br>
b. 1
<br><br>
c. 10
<br><br>
d. 11
<br><br>

<br><br>
Q3
<br><br>
Select all of the following methods that are instance methods of the Thread class, excluding any methods deprecated in Java 1.2.
<br><br>

<br><br>
a. start()
<br><br>
b. stop()
<br><br>
c. run()
<br><br>
d. suspend()
<br><br>
e. sleep( long msec )
<br><br>
f. toString()
<br><br>

<br><br>
Q4
<br><br>
You are writing a set of classes related to cooking and have created your own exception hierarchy derived from java.lang.Exception as follows
<br><br>

<br><br>
   Exception
<br><br>
   +-- BadTasteException
<br><br>
          +-- BitterException
<br><br>
          +-- SourException
<br><br>

<br><br>
Your base class, "BaseCook" has a method declared as follows
<br><br>

<br><br>
   int rateFlavor(Ingredient[] list) throws BadTasteException
<br><br>

<br><br>
A class, "TexMexCook", derived from BaseCook has a method which overrides BaseCook.rateFlavor().  Which of the following are legal declarations of the overriding method?
<br><br>

<br><br>
a. int rateFlavor(Ingredient[] list) throws BadTasteException
<br><br>
b. int rateFlavor(Ingredient[] list) throws Exception
<br><br>
c. int rateFlavor(Ingredient[] list) throws BitterException
<br><br>
d. int rateFlavor(Ingredient[] list)
<br><br>

<br><br>
Q5
<br><br>
You are working on an aquarium simulation class named Aquarius. You already have a method which adds a Fish object to the aquarium and returns the remaining fish capacity. This method has the following declaration.
<br><br>

<br><br>
     public int addFish( Fish f )
<br><br>

<br><br>
Now you want to provide for adding a whole shoal of fish at once. The proposed method declaration is
<br><br>

<br><br>
     protected boolean addFish( Fish[] f )
<br><br>

<br><br>
The idea being that it will return true if there is more room in the tank or false if the tank now too full. Which of the following statements about this proposal are true?
<br><br>

<br><br>
a. This technique is called overloading.
<br><br>
b. This technique is called overriding.
<br><br>
c. The compiler will reject the new method because the return type is different.
<br><br>
d. The compiler will reject the new method because the access modifier is different.
<br><br>

<br><br>
Q6
<br><br>
You have created a TimeOut class as an extension of Thread, the purpose being to print a "Time's Up" message if the Thread is not interrupted within 10 seconds of being started.
<br><br>

<br><br>
Here is the run method which you have coded.
<br><br>
1.   public void run(){
<br><br>
2.     System.out.println("Start!");
<br><br>
3.      try {
<br><br>
4.         Thread.sleep(10000 );
<br><br>
5.        System.out.println("Time's Up!");
<br><br>
6.      } catch(InterruptedException e) {
<br><br>
7.         System.out.println("Interrupted!");
<br><br>
8.      }
<br><br>
9.   }
<br><br>

<br><br>
Given that a program creates and starts a TimeOut object, which of the following statements is true?
<br><br>

<br><br>
a. Exactly 10 seconds after the start method is called, "Time's Up!" will be printed.
<br><br>
b. Exactly 10 seconds after "Start!" is printed, "Time's Up!" will be printed.
<br><br>
c. The delay between "Start!" being printed and "Time's Up!" will be 10 seconds plus or minus one tick of the system clock.
<br><br>
d. If "Time's Up!" is printed you can be sure at least 10 seconds have elapsed since "Start!" was printed.
<br><br>

<br><br>
Q7
<br><br>
What is the output of the following program?
<br><br>

<br><br>
 1.   class Base {
<br><br>
 2.     int x=3;
<br><br>
   
<br><br>
 3.     public Base() {}
<br><br>
    
<br><br>
 4.     public void show() {
<br><br>
 5.       System.out.print(" The value is " + x);
<br><br>
 6.     }
<br><br>
         
<br><br>
 7.   } 
<br><br>
  
<br><br>
 8.   class Derived extends Base {
<br><br>
 9.     int x=2;
<br><br>
     
<br><br>
10.     public Derived() {}
<br><br>
     
<br><br>
11.     public void show() {
<br><br>
12.       System.out.print(" The value is " + x);
<br><br>
13.     }
<br><br>

<br><br>
14.   }
<br><br>
  
<br><br>
15.   public class Test {
<br><br>

<br><br>
16.     public static void main(String args[]) {   
<br><br>
17.       Base b = new Derived();
<br><br>
18.       b.show();
<br><br>
19.       System.out.println("The value is " +b.x);
<br><br>
20.     } 
<br><br>

<br><br>
21.	} // end of class Test  
<br><br>

<br><br>
a.  The value is 3 The value is 2
<br><br>
b.  The value is 2 The value is 3
<br><br>
c.  The value is 3 The value is 3
<br><br>
d.The value is 2 The value is 2
<br><br>

<br><br>
Q8
<br><br>
What is the output of the following code?
<br><br>

<br><br>
 1.   public class Note {
<br><br>

<br><br>
 2.     public static void main(String args[]) {
<br><br>
 3.       String name[] = {"Killer","Miller"};
<br><br>
 4.       String name0 = "Killer";        
<br><br>
 5.       String name1 = "Miller";
<br><br>
 6.       swap(name0,name1);
<br><br>
 7.       System.out.println(name0 + "," + name1);
<br><br>
 8.       swap(name);
<br><br>
 9.       System.out.println(name[0] + "," + name[1]); 
<br><br>
10.     }
<br><br>
      
<br><br>
11.     public static void swap(String name[]) {
<br><br>
12.       String temp;
<br><br>
13.       temp=name[0];
<br><br>
14.       name[0]=name[1];
<br><br>
15.       name[1]=temp;
<br><br>
16.     }  
<br><br>
      
<br><br>
17.     public static void swap(String name0,String name1) {
<br><br>
18.       String temp;
<br><br>
19.       temp=name0;
<br><br>
20.       name0=name1;
<br><br>
21.       name1=temp;
<br><br>
22.     }    
<br><br>
23.   } // end of Class Note   
<br><br>

<br><br>
a.   Killer,Miller followed by Killer,Miller
<br><br>
b.   Miller,Killer followed by Killer,Miller
<br><br>
c.   Killer,Miller followed by Miller,Killer 
<br><br>
d.   Miller,Killer followed by Miller,Killer
<br><br>

<br><br>
Q9
<br><br>
What is the output of the following program?
<br><br>

<br><br>
 1.   public class Q11 {
<br><br>
 2.     static String str1 = "main method with String[] args";
<br><br>
 3.     static String str2 = "main method with int[] args";
<br><br>
    

⌨️ 快捷键说明

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