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

📄 解析7.htm

📁 这是JAVA考试的经常出错的一些题型
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<Meta http-equiv="Pragma" Content="No-cach">
<title>SCJP认证套题解析之七 -- 最大的IT资源网</title>
<link href="/img/P5-06-css.css" rel="stylesheet" type="text/css">
</head>
<script language="JavaScript">
function GetContentWnd(){ return parent; }
function OnSave(){	
				var oWnd = GetContentWnd();
				window.external.addFavorite( 

oWnd.location.href, oWnd.document.title );
			}
//双击鼠标滚动屏幕的代码
var currentpos,timer;
function initialize()
{
timer=setInterval ("scrollwindow()",80);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos !=document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
</script>
<Script LANGUAGE="JavaScript">
if(self!=top){top.location=self.location;}
</script>
<body oncontextmenu="return false;" onload="setimg();">
<table width="750" border="0" align="center" cellpadding="0" 

cellspacing="0">
  <tr>
    <td height="26" valign="top"><table width="100%"  border="0" 

cellpadding="0" cellspacing="0">
      <tr>
        <td height="22" align="center"><script src="/js/P5-head.js"></script></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="82" align="center" valign="top" 

bgcolor="#D2D2D2"><table width="750" border="0" cellpadding="0" 

cellspacing="0">
      <tr>
        <td height="80" align="center" bgcolor="#FFFFFF"><script src="/ad/k15-5-1.js"></script></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="30" valign="top"><table width="100%"  border="0" 

cellpadding="0" cellspacing="0">
      <tr>
        <td width="85" height="30"><img src="/img/P5-06-01.gif" 

width="85" height="30"></td>
        <td width="85"><a href="javascript:OnSave();"><img 

src="/img/P5-06-02.gif" width="85" height="30" border="0"></a></td>
        <td width="8" align="center" valign="top"><img src="/img/P5-06

-03.gif" width="8" height="8"></td>
        <td width="8" align="left" valign="bottom" 

bgcolor="#F2F2F2"><img src="/img/P5-06-04.gif" width="8" 

height="8"></td>
        <td width="10" bgcolor="#F2F2F2">&nbsp;</td>
        <td width="418" bgcolor="#F2F2F2"><a href="/">豆豆首页</a> - <a href="http://www.ddvip.net/index.htm">在线教程</a> - <a href="/cert/index.htm">认证考试</a> - <a href="/cert/java/index.htm">JAVA认证</a> - <a href="/cert/java/index3/index.htm">培训资源</a></td>
        <td width="136" bgcolor="#F2F2F2"><marquee scrollamount="4">最

大的中文IT资源网
            </marquee></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%"  border="0" align="left" cellpadding="0" 

cellspacing="0">
      <tr>
        <td valign="top"><table width="100%"  border="0" 

cellpadding="0" cellspacing="0">
          <tr>
            <td align="center">&nbsp;</td>
            <td width="20" rowspan="2">&nbsp;</td>
          </tr>
          <tr>
            <td height="50" align="center" style="border-bottom:1px 

dashed #666666"><strong class="f16">SCJP认证套题解析之七</strong></td>
          </tr>
          <tr>
            <td height="40" align="center"> 作者:unknown   更新时间:

2005-03-22 </td>
            <td rowspan="6" valign="top" style="border-right:1px solid 

#666666">&nbsp; </td>
          </tr>
          <tr>
            <td height="40">&nbsp;</td>
            </tr>
          <tr>
            <td><table width="100%"  border="0" cellpadding="0" 

cellspacing="0" class="pagefont">
              <tr>
                <td><p class="line-height"><br>
   31、Given the following code fragment: <br>
   1) String str = null; <br>
<br>
   2) if ((str != null) &amp;&amp; (str.length() &gt; 10)) { <br>
<br>
   3) System.out.println("more than 10"); <br>
<br>
   4) } <br>
<br>
   5) else if ((str != null) &amp; (str.length() &lt; 5)) { <br>
<br>
   6) System.out.println("less than 5"); <br>
<br>
   7) } <br>
<br>
   8) else { System.out.println("end"); } <br>
   Which line will cause error? <br>
<br>
   A. line 1 <br>
<br>
   B. line 2 <br>
<br>
   C. line 5 <br>
<br>
   D. line 8 <br>
<br>
   (c) <br>
<br>
   题目:给出下面的代码片断: <br>
   … <br>
   哪些行将导致错误。 <br>
<br>
   此题需要将代码仔细看清楚,查询没有逻辑错误,if …else的使用没有问题,也没有拼写错误,错误在于第5行的“与”操作符的使用,逻辑操作符(logical operator)的“与”


 应该是&amp;&amp;,而&amp;是位逻辑操作符(bitwise logical operator)的“与”,使用的对象不一样,逻辑操作符的“与”的左右操作数都应该是布尔型(logical boolan)的值,而位逻辑操作符的左右操作数都是整型(integral)值。 <br>
 <br>
   32、Which statements about Java code security are true? <br>
<br>
   A. The bytecode verifier loads all classes needed for the execution of a program. <br>
<br>
   B. Executing code is performed by the runtime interpreter. <br>
<br>
   C. At runtime the bytecodes are loaded, checked and run in an interpreter. <br>
<br>
   D. The class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources. <br>
<br>
   (bcd) <br>
<br>
   题目:下面有关java代码安全性的叙述哪些是对的。 <br>
   A. 字节码校验器加载查询执行需要的所有类。 <br>
<br>
   B. 运行时解释器执行代码。 <br>
<br>
   C. 在运行时,字节码被加载,验证然后在解释器里面运行。 <br>
<br>
   D. 类加载器通过分离本机文件系统的类和从网络导入的类增加安全性。 <br>
<br>
   SL275中描述的Java程序运行的过程是这样的:类加载器(class loader)加载程序运行所需要的所有类,它通过区分本机文件系统的类和网络系统导入的类增加安全性,这可以限制任何的特洛伊木马程序,因为本机类总是先被加载,一旦所有的类被加载完,执行文件的内存划分就固定了,在这个时候特定的内存地址被分配给对应的符号引用,查找表(lookuo table)也被建立,由于内存划分发生在运行时,解释器在受限制的代码区增加保护防止未授权的访问;然后字节码校验器(byte code verifier)进行校验,主要执行下面的检查:类符合JVM规范的类文件格式,没有违反访问限制,代码没有造成堆栈的上溢或者下溢,所有操作


 代码的参数类型都是正确的,没有非法的数据类型转换(例如将整型数转换成对象类型)发生;校验通过的字节码被解释器(interpreter)执行,解释器在必要时通过运行时系统执行对底层硬件的合适调用。后三个答案是SL275中的原话。 <br>
 <br>
   33、Given the following code: <br>
   public class Person{ <br>
   static int arr[] = new int[10]; <br>
   public static void main(String a[]) { <br>
   System.out.println(arr[1];) <br>
   } <br>
   } <br>
   Which statement is correct? <br>
   A. When compilation some error will occur. <br>
<br>
   B. It is correct when compilation but will cause error when running. <br>
<br>

⌨️ 快捷键说明

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