📄 java.txt
字号:
23. 下面 类是过滤流FilterInputStream的子类。
A.DataInputStream B.DataOutputStream
C.PrintStream D.BufferedOutputStream
24. 下面这些方法中 方法不是Applet的基本方法。
A. init() B. run() C. stop() D. start()
25. 下面 是Runnable接口中的抽象方法。
A. start B. stop C. yield D. run
===============================================================================================
32. 编译并运行以下程序,以下描述哪个选项是正确的( )
1. class X{ 2. public String toString(){ 3. return super.toString();} 4. }
A、编译通过运行无异常 B、编译通过但运行时出错 、
C、行2出错,不能成功编译 D、不能成功编译,行3出错
33. 下列关于修饰符混用的说法,错误的是( )
A. abstract不能与final并列修饰同一个类
B. abstract类中不可以有private的成员
C. abstract方法必须在abstract类中
D. static方法中能处理非static的属性
35. 以下标识符中哪项是合法的是(选两个 )
A、 BigMeaningless Name B、$int C、 1 st D、_1
==============================================================================================================
1下面的语句会产生什么样的输出?
<br>System.out.println(4&7);
<br>A.4
<br>B.5
<br>C.6
<br>D.7
<br>E.0
<br>2分析下面代码,选择正确答案.
<br>A.这行代码不能编译。
<br>B.代码编译,但不产生任何输出
<br>C.代码编译并且输出ture
<br>3下面的程序中,temp的最终值是什么?
<br>long temo=(int)3.9;
<br>temp%=2;
<br>A 0
<br>B 1
<br>C 2
<br>D 3
<br>E 4
<br>4默认情况下,也就是没有关键字时,所有的类都能访问所有成员,除了以下成员
<br>A 用final关键值定义的
<br>B 用abstract关键字定义的
<br>C 在另一个包中定义的
<br>D 在同一个包中定义的
<br>5下面哪个不是JAVA关键字
<br>A integer
<br>B double
<br>C float
<br>D default
<br>6选择合法的JAVA标识符
<br>A userName
<br>B %passwd
<br>C 3d_game
<br>D $charge
<br>E this
<br>7哪些可用于处理Unicod字符
<br>A InputStreamReader
<br>B BufferedReader
<br>C Writer
<br>D PipedInputStream
<br>8表达式5&2的值应该是
<br>A 0
<br>B 2
<br>C 5
<br>D 7
=================================================================================================================================
2. Which of the following statements are true?
I. ArrayLists cannot be used in situations where the number of elements never changes.
II. ArrayLists are useful in situations where the number of elements stored is likely to change over time.
III. The size of an Arraylist can never exceed its initial capacity.
A. I only
B. II only
C. III only
D. II and III only
E. I, II, and III
3. Which of the following code fragments successfully reverses the order of the elements in the ArrayList t?
I. // t is an ArrayList
for ( int i = 0 ; i < t.size() ; i++ )
t.add( t.get( i ) );
II. // t is an ArrayList
for ( int i = 0 ; i < t.size() ; i++ )
{
t.add( t.get( 0 ) );
t.remove( 0 );
}
III. // t is an ArrayList
for ( int i = 0 ; i < t.size() ; i++ )
{
t.remove( t.size() - 1 - i );
t.add( t.get( i ) );
}
A. I only
B. II only
C. III only
D. I, II and III
E. None of the above.
4. An ArrayList is needed to keep track of twelve ints. Which of the following statements successfully creates an ArrayList that can be used for this purpose?
I. ArrayList<int> a = new ArrayList<int>( 25 );
II. ArrayList<Integer> a = new ArrayList<Integer>( 25 );
III. ArrayList<Integer> a = new ArrayList<Integer>();
A. I only
B. II only
C. III only
D. II and III only
E. I, II, and III
The remaining questions on this test are concerned with the Person and Family classes, defined as follows:
*public class Person
{
private String myName;
private int myAge;
private Person myNextSibling;
public Person( String name, int age )
{
myName = name;
myAge = age;
myNextSibling = null;
}
public void birthday()
{
myAge++;
}
public int getAge()
{
return myAge;
}
public String getName()
{
return myName;
}
public void setNextSibling( Person p )
{
myNextSibling = p;
}
public Person getNextSibling()
{
return myNextSibling;
}
}
*public class Family
{
private ArrayList<Person> myMembers;
public Family()
{
myMembers =
new ArrayList<Person>();
}
public void addMember( Person p )
{
myMembers.add( p );
}
public ArrayList<Person> getMembers()
{
return myMembers;
}
}
5. Which of the following statements assigns a Person object to the variable p?
I. Person p = Person( "fred", 8 );
II. Person p = new Person( "fred", 8 );
III. Person p( "fred", 8 );
A. I only
B. II only
C. III only
D. I and II only
E. I, II and III
6. What is the output from the following code?
Person f;
f = new Person( "Thomas", 2 );
int i = 0;
while ( i < 5 )
{
f.birthday();
i++;
}
System.out.println( f.getAge() );
A. 0
B. 2
C. 5
D. 7
E. None of the above — an exception is thrown.
答案:
B
C
D
B
D
====================================================================================================
In Java, which statements ARE true?
1. When a thread sleeps, its locks are released
2. If a class has synchronized code, multiple threads can still access the non synchronized code.
3. Methods and variables can be protected from concurrent access problems by marking them with the synchronized keyword.
4. When a thread invokes wait(), its locks are released.
5. A static method cannot be synchronized
string m="n"+969
string n="n97"
以下表达式的值是FALSE的有
A,m.indexof("6")==2
B,m.toupper=="N969"
C,m.charAt(2)=="9"
D,m.length()>n.length()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -