问题 单项选择题

假设有String a="A:;char='A';int c=65,选项______是正确的。

A.if(a=={Systeouprint("Equal")}

B.if(c=={Systeouprint("Equal")}

C.if(a=={Systeouprint("Equal")}

D.以上均不正确

答案

参考答案:B

解析: 由于Java是强类型语言,String型变量不能和char、int型变量直接进行对比,所以选项A、C均不正确。但如果char和int型变量在同一个表达式中运算,系统是可以进行自动类型转换的,因此这两个类型的变量之间可以进行比较。由于字母A的ASCII码值为65,所以c=b,故选项B正确。

阅读理解

阅读理解。

The word "Hello" may be used more often than any other word in the English language. Everyone in the

USA and other countries uses this word.

      Thomas Edison is believed to be the first person to use "Hello" on the telephone soon after the world's

first telephone was invented.

       At first people began their words on the telephone with "Are you there?" They were not sure if a

telephone could really carry voices.

     Edison was a man with few words. He wanted to save time. The first time he picked up the phone, he

was very busy. He trusted (信任) the telephone as he invented it himself. He was sure someone was there

and only said "Hello".

      From then on, "Hello" is often heard when you pick up the telephone.

1."Hello" may be used _____. [ ]

A. only in the USA

B. only in England

C. in many countries

D. in English-speaking countries except the USA

2. From the passage we can learn that Edison _____. [ ]

A. didn't like the word "Hello"

B. didn't know the word "Hello"

C. had nothing to do with the word "Hello"

D. might be the first one to use "Hello" on the telephone

3. At first people said "Are you there?" because _____. [ ]

A. they didn't trust the telephone

B. they didn't know each other

C. they couldn't see each other

D. they wanted to ask each other questions

4. Edison was a man of few words. It means _____. [ ]

A. he knew few words

B. He could say few words

C. He didn't like to talk much

D. He had few friends

5. Edison was sure someone was there because _____. [    ]

A. he could see the person

B. he knew the person

C. he invented the telephone and trusted it

D. he had just met the person

问答题 简答题