问题 单项选择题

下列代码中,将引起一个编译错误的行是【 】1)public class Test{2) int m,n;3)public Test(){}4)public Test(int a){m=a;}5)public static void main(String args[]){6)Test t1,t2;7)int j,k;8)j=0;k=0;9)t1=new Test();10)t2=new Test(j,k);11) }12) }

A.第3行

B.第5行

C.第6行

D.第10行

答案

参考答案:D

解析:本题考查考生对Java中构造方法的理解及应用。构造方法名必须与类名相同,没有返回值,用户不能直接调用,只能通过new自动调用。题目有两个构造方法Test()和Test(int a),按照参数决定调用哪个方法。t1=new Test()语句调用Test()方法,而t2=new Test(j,k)将会找不到相应的构造方法,程序编译出错在第10行,所以选项D说法正确。

解答题
阅读理解

阅读理解。

     Looking back on my childhood, I am convinced that naturalists are born and not made. Although we were

all brought up in the same way, my brothers and sisters soon left their pressed flowers and insects. Unlike them,

I had no ear for music and languages. I was not an early reader and I could not do mental arithmetic.

     Before World War I we spent our summer holidays in Hungary. I have only the dim (模糊的) memory of

the house we lived in, of my room and my toys. Nor do I recall clearly the large family of grandparents, aunts,

uncles and cousins who gathered next door. But I do have a clear memory of the dogs, the farm animals, the

local birds, and above all, the insects.

     I am a naturalist, not a scientist. I have a strong love of the natural world and my enthusiasm had led me into

varied investigations (调查研究). I love discussing my favorite topics and enjoy burning the midnight oil reading

about other people's observations and discoveries. Then something happens that brings these observations

together in my conscious (清醒的) mind. Suddenly you fancy you see the answer to the riddle, because it all

seems to fit together. This has resulted in my publishing 300 papers and books, which some might honor with

the title of scientific research.

     But curiosity, keen (敏锐的) eyes, a good memory and enjoyment of the animal and plant world do not make

a scientist: one of the excellent and essential qualities required is self-discipline, a quality I lack. A scientist, up to

a certain point, can be made. A naturalist is born. If you can combine the two, you get the best of both worlds.

1. The first paragraph tells us the author _____. [ ]

A. was interested in flowers and insects in his childhood

B. lost his hearing when he was a child

C. didn't like his brothers and sisters

D. was born into a naturalist's family

2. The author can't remember his relatives clearly because _____. [ ]

A. he didn't live very long with them

B. the family was extremely large

C. he was too young when he lived with them

D. he was fully occupied with observing nature

3. The author can't remember his relatives clearly because _____. [ ]

A. he didn't live very long with them

B. the family was extremely large

C. he was too young when he lived with them

D. he was fully occupied with observing nature

4. The author says that he is a naturalist rather than a scientist probably because he thinks he _____.[ ]

A. has a great deal of trouble doing mental arithmetic

B. lacks some of the qualities required of a scientist

C. just reads about other people's observations and discoveries

D. comes up with solutions in a most natural way