问题 单项选择题

下面程序执行后,屏幕上显示的应是( )。
public class Test
public static void main(String[ ] args)

char ch1[]=’B’,’e’,’i’,’j’,’i’,’n’,’g’;
char ch2[]=’B’,’e’,’i’,’j’,’i’,’n’,’g’,’2’,’0’,’0’,’8’;
String s1 = new String(ch1);
String s2 = new String(ch2, 0, 7);
System. out. println(sl. equals(s2));

A.true

B.false

C.Beijing

D.编译错误

答案

参考答案:A

解析: 首先可以通过字符数组来生成一个字符串对象:
String(char[] value);
String(char valne, int startIndex, int numChars);其中,startlndex指定字符串在数组中的起始下标,numChars表示字符个数。
然后再测试字符串是否相等,可调用equals()方法,两串相等则返回true,否则返回false。

阅读理解

阅读理解。

     Early to bed, early to rise, makes a man healthy, wealthy and wise.

     This is an old English saying. Have you heard of it before? It means that we must go to bed early

and get up early in the morning. Then we shall be healthy. We shall also be rich (wealthy) and clever

(wise).

     This is true. The body must have enough sleep to be healthy. Children of young age should have

ten hours' sleep every night. Children who do not have enough sleep cannot do their work very well.

They will not be wise and they may not become wealthy!

     The body also needs exercise. Walking, running, jumping, swimming and playing games are all

exercise.

     Exercise keeps the body strong. Exercise also helps the blood (血液) to move around inside the

body. This is very important. Our blood takes food to all parts of our body. The head also needs blood.

Exercise helps us to think better!

1. If we get up early and go to bed early, we'll _____. 

A. have enough exercise

B. be healthy

C. think better

D. have strong blood

2. If a child doesn't have 10 hours' sleep, maybe he _____.

A. becomes wise

B. won't do well in his work

C. goes to school in time

D. has enough sleep

3. A person needs exercise because _____.

A. it makes him healthy

B. he has a lot of homework to do

C. he is strong enough

D. he does exercise

4. Exercise makes the _____ move quickly and smoothly (流畅).

A. body

B. blood

C. children

D. head

5. Which of the following is NOT TRUE?

A. Exercise does good to a person's head.

B. A student should have 10 hours' sleep.

C. It's good for you to get up early and go to bed early.

D. If you have enough blood, you'll be wise.

多项选择题