例题7:
True or False: Readers have methods that can read and return floats and doubles.
A. Ture
B. False
解答:B
点评: Reader/Writer只处理Unicode字符的输入输出。float和double可以通过stream进行I/O.
例题8:
What does the followingpaint() method draw?
1. public void paint(Graphics g) {
2. g.drawString(“Any question”, 10, 0);
3. }
A. The string “Any question?”, with its top-left corner at 10,0
B. A little squiggle coming down from the top of the component.
解答:B
点评:drawString(String str, int x, int y)方法是使用当前的颜色和字符,将str的内容显示出来,并且最左的字符的基线从(x,y)开始。在本题中,y=0,所以基线位于最顶端。我们只能看到下行字母的一部分,即字母‘y’、‘q’的下半部分。 |