/**
*
* @author yaoyuan
*/
10 package com.sun.scjp;
11 public class Geodetics{
12 public static final double DIAMETER = 12756.32; //kilometers
13 }
Which two correctly access the DIAMETER member of the Geodetics class?(choose two)
A import com.sun.scjp.Geodetics;
public class TerraCarta{
public double halfway(){
return Geodetics.DIAMETER/2.0;
}
}
B import static com.sun.scjp.Geodetics;
public class TerraCarta{
public double halfway(){
return DIAMETER/2.0;
}
}
C import static com.sun.scjp.Geodetics.*;
public class TerraCarta{
public double halfway(){
return DIAMETER/2.0;
}
}
D import com.sun.scjp;
public class TerraCarta{
public double halfway(){
return DIAMETER/2.0;
}
}
Answer: A C
/**
*参考静态导入
*/
/**
*
* @author yaoyuan
*/
10 class Line{
11 public static class Point{}
12 }
13
14 class Triangle{
15 //insert code here
16 }
Which code inserted line 15, creates an instance of the Point class defined in Line?
A Point p = new Point();
B Line.Point p = new Line.Point();
C The Point class cannot be in statiated at line 15
D Line l = new Line(); l.Point p = new l.Point();
Answer : B
/**
*
* @author yaoyuan
*/
1 public class Plant{
2 private String name;
3 public Plant(String name){this.name = name;}
4 public String getName(){return name;}
5
1 public class Tree extends Plant{
2 public void growFruit(){}
3 public void dropLeaves(){}
4 }
Which statement is true?
A The code will compile without changes.
B The code will compile if public Tree(){Plant();} is added to the Tree class
C The code will compile if public Plant(){Tree();} is added to the Plant class
D The code will compile if public Plant(){this("fern");} is added to the Plant class
E The code will compile if public Plant(){Plant("fern");} is added to the Plant class
Answer : D
/**
*
* @author yaoyuan
*/
10 public class Bar{
11 static void foo(int x){
12 //insert code here
13 }
14 }
Which two code fragments inserted indepently at line 12, will allow the class to compile?(Choose two)
A foreach(x) System.out.println(z);
B for(int z : x) System.out.println(z);
C while(x.hashNext()) System.out.println(x.next());
D for(int i=0;i<x.length;i++) System.out.println(x[i]);
Answer : B D
/**
*
* @author yaoyuan
*/
1 class ClassA{
2 public int numberOfInstances;
3 protected ClassA(int numberOfInstances){
4 this.numberOfInstances = numberOfInstances;
5 }
6 }
7 public class ExtendedA extends ClassA{
8 private ExtendedA(int numberOfInstances){
9 super(numberOfInstances);
10 }
11 public static void main(String[] args){
12 ExtendedA ext = new ExtendedA(420);
13 System.out.print(ext.numberOfInstances);
14 }
15 }
Which statement is true?
A 420 is the output
B An exception is thrown at runtime
C All constructors must be declared public
D Constructors cannot use the private modifier
E Constructors cannot use the protected modifier
Answer: A
/**
*
* @author yaoyuan
*/
1 public class Base{
2 public static final String FOO = "foo";
3 public static void main(String[] args){
4 Base b = new Base();
5 Sub s = new Sub();
6 System.out.print(Base.FOO);
7 System.out.print(Sub.FOO);
8 System.out.print(b.FOO);
9 System.out.print(s.FOO);
10 System.out.print(((Base)s).FOO);
11 }}
12 class Sub extends Base{public static final String FOO = "bar";}
What is the result?
A foofoofoofoofoo
B foobarfoobarbar
C foobarfoofoofoo
D foobarfoobarfoo
E barbarbarbarbar
F foofoofoobarbar
Answer: D
/**
*
* @author yaoyuan
*/
Which two statements are true about has-a and is-a relationships?(Choose two)
A Inheritance represents an is-a relationship
B Inheritance repersents an has-a relationship
C Interfaces must be use when creating a has-a relationship
D Instance variables can be used when creating a has-a relationship
Answer:A D
/**
*
* @author yaoyuan
*/
1 package geometry;
2 public class Hypotenuse{
3 public InnerTriangle it = new InnerTriangle();
4 class InnerTriangle{
5 public int base;
6 public int height;
7 }
8 }
Which statement is true about the class of an object that can reference the variable base?
A It can be any class
B No class has access to base
C The class must be long to the geometry package
D The class must be a subclass of the class Hypotenuse
Answer: C
/**
*
* @author yaoyuan
*/
1 interface A{public void aMethod();}
2 interface B{public void bMethod();}
3 interface C extends A,B{public void cMethod();}
4 class D implements B{
5 public void bMethod(){}
6 }
7 class E extends D implements C{
8 public void aMethod(){}
9 public void bMethod(){}
10 public void cMethod(){}
11 }
What is the result?
A Compilation fails because of an error in line 3
B Compilation fails because of an error in line 7
C Compilation fails because of an error in line 9
D if you define D e = new E(),then e.bMethod() invokes the version of bMethod() defined in line 5
E if you define D e = (D)(new E()),then bMethod() invokes the version of bMethod() defined in line 5
F if you define D e = (D)(new E()),then bMethod() invokes the version of bMethod() defined in line 9
Answer: F
/**
*
* @author yaoyuan
*/
Which two statements are true?(Choose two)
A An encapsulation,public class promotes re-use
B Classes that share the same interface are always tightly encapsulated
C An encapsulation class allow subclasses to overload methods, but does not allow overriding methods
D An encapsulation class allow programmer to change an implementation without affecting outside code.
Answer:A D
分享到:
- 2008-11-26 10:46
- 浏览 1283
- 评论(0)
- 论坛回复 / 浏览 (0 / 2377)
- 查看更多
相关推荐
这个压缩包文件包含了多个与SCJP认证相关的学习资源,包括试题、题库和答案,以及一些重要的复习资料。 1. **SCJP认证概述**:SCJP是Java初学者或初级开发者提升职业资质的重要途径。通过这个认证,开发者可以证明...
Java认证,全称为Sun Certified Programmer for the Java 2 Platform, Standard Edition ...以上这些知识点都是SCJP认证考试的重点,通过深入学习和大量练习,考生可以提升自己的Java编程技能,提高通过考试的可能性。
本压缩包文件提供了三个部分的"JAVA SCJP认证模拟试题",分别是"SCJP模拟试题(一).doc"、"SCJP模拟试题(二).doc"和"SCJP模拟试题(三).doc",这些文档可能包含了多个章节的练习题目,覆盖了Java语言的核心概念...
SCJP认证试题通常涵盖以下几个主要领域: 1. **Java语言基础**:包括基本语法、数据类型、变量、运算符、流程控制(如if-else、switch、for、while循环)、方法、数组等。这些是Java编程的基础,理解和熟练掌握它们...
SCJP认证的学习资料通常会包含详细的理论讲解、实例演示、习题解答和模拟试题,帮助学习者全面掌握这些知识点。通过阅读这5本书,你将有机会深入理解Java语言的各个方面,为SCJP认证考试做好充分准备。同时,不断...
这份"java scjp模拟试题"包含三套模拟测试题,是准备SCJP认证考试的宝贵资源。通过这些试题,考生可以检验自己的知识掌握程度,熟悉考试的格式和题型,提高备考效率。 模拟试题通常涵盖以下几个关键知识点: 1. **...
SCJP,全称为Sun Certified Programmer for the Java 2 Platform,是Oracle公司(原Sun Microsystems)推出的针对Java程序员的认证考试。这个考试旨在测试考生对于Java SE平台基础编程的知识和技能。以下是一些SCJP...
根据给定的文件信息,以下是对“SCJP认证试题”中的关键知识点的详细解析: ### SCJP认证概览 SCJP(Sun Certified Programmer for Java Platform)是Java领域中最具权威的专业程序员认证之一,由Sun Microsystems...
Java SCJP(SUN Certified Programmer for the Java Platform)是针对Java初学者的一项认证考试,它主要测试考生对Java基础知识的理解和应用能力。...熟悉并掌握这些知识点对于通过SCJP认证考试至关重要。
首先,我们要了解SCJP认证涉及的基础知识: 1. **Java语言基础**:包括数据类型(如整型、浮点型、字符型、布尔型)、变量声明、运算符(算术、关系、逻辑、位、赋值等)、流程控制(if-else、switch、循环、跳转...
"SCJP认证套题解析"是一个针对这项认证的备考资源,通常包括一系列模拟试题、答案解析以及相关的知识点讲解。 SCJP认证覆盖的知识点广泛,主要包括以下几个方面: 1. **Java语言基础**:这部分内容涉及Java语法、...
总的来说,准备SCJP认证需要系统学习Java语言的核心概念,并通过大量的实践和模拟试题来提高编程能力和应对考试的能力。这个压缩包文件很可能是备考SCJP的一个重要资源,考生应当充分利用其中的资源进行复习和准备。
### Java SCJP考试知识点解析 #### 题目87: 命令行参数解析与输出 **题目描述:** 在给定的代码中,`Test` 类包含了一个 `main` 方法,该方法试图从命令行参数数组 `args` 中获取元素并将其赋值给 `String` 类型的...
【JAVA认证历年真题 SCJP认证套题解析】主要涵盖了JAVA语言的基础知识,包括数据类型、标识符规则、数值类型转换、字符串操作以及对象和类的使用等方面。以下是这些知识点的详细说明: 1. **数据类型**:题目中提到...
SCJP(Sun Certified Programmer for the Java 2 Platform, Standard Edition)是Oracle公司为Java程序员提供的一项认证考试,旨在验证考生对Java编程语言的基础知识和理解。这个认证在Java社区中非常受到重视,因为...
首先,SCJP认证是Java程序员入门阶段的重要凭证,它证明了持有者具备编写和调试Java程序的基本技能。这个认证涵盖了语言特性、类库、内存管理以及异常处理等方面的基础知识。 1. **Java语言特性**:书中会涵盖Java...
SCJP认证考试通常涵盖以下几个核心领域: 1. **Java语法**:包括基本的数据类型、变量、运算符、流程控制(if语句、switch、循环)、方法、类和对象的概念,以及异常处理。理解这些基础知识是编写任何Java程序的...
Java国际认证(SCJP)典型试题1000例 高清版 pdf 作者: 施铮 出版社: 电子科技大学出版社 出版年: 2005-8 页数: 493 ISBN: 9787810948142