- 浏览: 121559 次
- 性别:
- 来自: 武汉
文章分类
最新评论
-
Odysseus_110:
terryang 写道lz加上时间也不太合适,刷新太快的话还是 ...
$.getJSON 缓存 -
ll.james:
5楼的,真管用通知公告模块A.通知公告的类型没有实现控制B.通 ...
$.getJSON 缓存 -
zranye:
这样虽然能启动,但是会出现乱码
resin 无法启动 com.caucho.config.LineConfigException: -
酒杯中的大海:
学习了!!!~
struts 文件上传 乱码 -
酒杯中的大海:
牛逼,膜拜~
struts 文件上传 乱码
The default constructor has the same access as its class
which gets the name of the parent directory file “file.txt”?
String name = (new File(“file.txt”)).getParent();
which of these are valid JavaBeans method signatures?
A public void removeWibbleListener(BurbleListener w)
B public void addElement(Element e)
C public boolean getActive()
D public boolean isActive()
E int getFooNumber()
F public long size()
The correct options are C and D.With regards to the JavaBeans naming conventions:
E is incorrect because getter and setter methods must be public
B is incorrect because an add… or remove… method must end in ….Listener
A is incorrect because a removeWibbleListener method must take a WibbleListener as its argument
which methods can be declared at the position indicated and not cause a compile-time error?
A protected void drawSting()
B void drawSting();
C public abstract void drawSting();
D public static void drawSting();
E strictfp void drawSting();
The correct options are B and C
Interface method declarations are implicitly public and abstract,and these modifiers can be omitted.Interface methods cannot be static(ruling out D),nor can they be marked strictfp(ruling out E) ,final or native.Marking A protected conflicts with the restriction that interface methods must be public.
Fill in the table to indicate which Exception and Error classes are typically thrown programmatically and which by the JVM.
Exception/Error class Typically thrown…?
ArrayIndexOutOfBoundsException By the JVM
ClassCastException By the JVM
IllegalArgumentException Programatically
IllegalStateException Programatically
NullPointerException By the JVM
NumberFormatException Programatically
AssertionError Programatically
ExceptionInInitalizerError By the JVM
StackOverflowError By the JVM
NoClassDefFoundError By the JVM
How many lines don't compile ?
byte a = 127 + 1 ;
byte b = ( byte ) 25768 ;
char c = 127 ;
c+= 12345 ;
Answer: line 1 does not compile
127 is the max value of a byte. Casting makes everything ok. Remember += does an automatic cast.
class test { public static void main ( String [] args ) { final Integer x4 = 8; final int x = 10; switch ( x ) { case x4: System.out.println("4"); break; case x: System.out.println("x"); break; } } }
compile error
Final objects are not allowed in a case statement. A final object's value can be changed whereas a final variables value cannot be changed.
an interface may extend multiple interfaces
an ArithmeticException is a checked exception.
Answer:false
ArithmeticException are considered programmer problems ,and are Not checked by the compiler.A divide-by-zero error,for example,should be checked for by your own code.
Public class Demo{ public static void main(String[] args){ for(int i =0;i < 3;i++){ label1: switch(i){ case 0: System.out.println(“34”); case 1: System.out,println(“23”); break; case 2: System.out.println(“12”); case 3: System.out.println(“01”); break label1; default: System.out.println(“40”); } } } }
A The code is correct and it compiles.
label1: can lay before switch?
you can put label before any statement or block of code.
but you cannot call break labelX if you are not in its scope.
you are trying to call break label1 in switch case 3 but it is out of scope.
look this code about scopes:
label1: System.out.println("in label1");//here scope of this label is //this one statement so you can't //break label2:{ //here starts scope of label2 System.out.println("label 2 started"); break label2; // here you can use break in scope of this label System.out.println("label 2 ended"); //but it wont compile because compiler //knows this statement is unreachable } //here ends scope of label2 break label2; // you cant do this here because you are out of scope for(int i = 0; i < 5; i++){ // bla bla bla break label2; // you cant do this here because you are out of scope
which of these are legal escape sequences?
A \n
B \f
C \m
D \n
E \e
F \r
G \t
ABDFG
Remember the sentence:”Big farms need red tractors ”
only “b” “f” “n” “r” and “t” are legal,no other characters!
Which of the following statements are not true?
java.lang.Character does not extend java.lang.Number
java.lang.Void can't be extended but it can only be instantiated
java.lang.Integer can't be extended
java.lang.Character does not have a constructor that takes a String
java.lang.Byte does not extend java.lang.Number
B and E are correct. Only these two statements are NOT true. The class java.lang.Void is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void. This class is final and has a private constructor. Hence, it can neither be extended nor can it be instantiated.
The class java.lang.Byte does indeed extend java.lang.Number.
The class java.lang.Character does not extend java.lang.Number, and has only one constructor that takes a char value.
All wrapper classes are final, and hence they can not be extended.
It is perfectly legal in Java to create arrays of size zero.
在定义一个
native method
时,并不提供实现体(有些像定义一个
java interface
),因为其实现体是由非
java
语言在外面实现的。,下面给了一个示例:
public class IHaveNatives
{
native public void Native1( int x ) ;
native static public long Native2() ;
native synchronized private float Native3( Object o ) ;
native void Native4( int[] ary ) throws Exception ;
}
标识符 native 可以与所有其它的 java 标识符连用,但是 abstract 除外。这是合理的,因为 native 暗示这些方法是有实现体的,只不过这些实现体是非 java 的,但是 abstract 却显然的指明这些方法无实现体。
What will happen when you attempt to compile and run the following code?
class MyClass { static String myName = "SCJP"; MyClass getMyClass() { System.out.println(myName); return null; } public static void main(String[ ] args) { System.out.println( new MyClass().getMyClass().myName ); } }
Answer: Prints SCJP twice
C is the correct choice. The above method will not give any compilation error as at compile time, compiler sees the return type of getMyClass method as MyClass and calling myName on MyClass is valid at compile time.
Also it doesn't give any runtime error which is not very obvious. Please note that a null reference may be used to access a class (static) variable without causing an exception . The static variable is called on the class itself and not on the object. Had the myName variable non-static, the above code at run time would give NullPointerException.
- scjpnote.rar (283 KB)
- 描述: scjp学习笔记
- 下载次数: 8
发表评论
-
ant 正则表达式 换行符
2011-02-05 23:05 3086SSH上传文件的时候 报错 无法上传文件 可能是因为存在本地 ... -
ftp 文件上传 无法上传中文名称
2009-08-12 14:11 2253代码参考上一篇《ftp文件上传 文件损坏》 ... -
ftp 文件上传 文件损坏
2009-08-12 13:35 2809这里演示的是配置好ftp服务器后,通过java ... -
SCJP 5.0 Study Notes(3)
2009-07-03 22:11 858Enums <!---->· &l ... -
SCJP 5.0 Study Notes(2)
2009-07-03 21:48 955Encapsulation, coupling, cohesi ... -
C语言
2008-09-01 08:23 0(1)指针变量初始化的方法 int a;int *p=& ... -
tomcat
2008-07-08 17:38 0<Context crossContex ... -
SCJP 5.0 Study Notes(1)
2008-07-01 08:59 1046Note: Please feel free to mo ... -
Computer Science
2008-06-03 15:55 1285中文名称 :计算机科学 ... -
Integer中用静态内部类所作的缓存
2008-05-22 20:49 1536今天在做一个题目时,发现一个奇怪的Integer方法。 pub ... -
图片切割的研究
2008-05-15 14:35 0切割图片 -
SCJP tips
2008-05-09 10:21 12241. Thread t1 = new Thread(&quo ...
相关推荐
BB_s Notes4 SCJP1.4 是一份针对SCJP(SUN Certified Programmer for Java 1.4)认证考试的重点复习资料。这份笔记涵盖了Java语言的关键概念,包括基本数据类型、运算特性、字符串特点、类与方法修饰符、多态、覆盖...
根据给定文件的信息,我们可以提炼出一系列关于Java 6 SCJP考试的重要知识点,这些知识点涵盖了基本数据类型处理、面向对象编程、接口实现、匿名内部类、静态方法、异常处理、对象相等性与哈希码、初始化块、垃圾...
首先,"notes for scjp(1.4).doc"可能是一个关于Java 1.4版本的笔记,这涵盖了Java语言的基础,包括语法、数据类型、流程控制、异常处理、类和对象、包、接口等。Java 1.4是较早的版本,但基础概念对于理解后来的...
2. **学习笔记**: "scjp_amay's notes for 1.4.doc"可能是一位名叫Amay的学习者针对Java 1.4版本的SCJP考试整理的笔记,这个版本可能包含对当时Java语言特性的详细解析,例如原始类型、字符串常量池、异常处理机制等...
文档如"amay's2.doc"、"JavaCertificationStudyNotes.doc"、"amay's notes for 1.4.doc"和"mynote"都提供了不同角度的学习材料,有助于考生从不同层面理解和巩固知识。 在备考过程中,考生不仅要熟记理论知识,还要...
这份由网友提供的"notes for 1.4.doc"文档,很可能是关于SCJP 1.4版本的备考笔记,该版本对应的是Java SE 1.4,尽管现在已经有些过时,但其中的基础知识对于理解Java编程依然非常有价值。 【Java基础】文档可能会...
SCJP认证的sun官方课程资料-student guide with instruction notes.
### SCJP 学习笔记 for 1.4 #### 八进制与十六进制表示法 - **八进制数表示**: - Java 中,八进制数以数字 `0` 开头(不是字母 `o`)。例如,八进制数 `010` 实际上表示的是十进制数 `8`。 - **示例**:`System...
13. **其他网站** - 不断增加的各种关于 SCJP(Sun Certified Java Programmer)认证的相关网站。 #### 三、考试目标概览 根据文档中的描述,Java 认证考试的目标主要涵盖了以下几个方面: 1. **声明与访问控制** ...
2. "amay's notes for 1.4.doc":这看起来像是一个人(Amay)对某个版本或主题1.4的笔记,可能是对面试题目的解析或准备指南,可能是针对特定技术领域,如软件开发的某个版本或标准。 3. "scjp.txt":SCJP是“Sun ...
SCJP 6 --> OCP 8 & SCJP 7 --> OCP 8 的升级也存在 Java牧场 书 OCP:Oracle Certified Professional Java SE 8 Programmer II 学习指南:考试 1Z0-809 执照 MIT - Licence Copyright (c) 20