1。
How can you change the current working directory using an instance of the File class called FileName?
1) FileName.chdir("DirName")
2) FileName.cd("DirName")
3) FileName.cwd("DirName")
4) The File class does not support directly changing the current directory.
2。
If you create a TextField with a constructor to set it to occupy 5 columns, what difference will it make if you use it with a proportional font (ie Times Roman) or a fixed pitch typewriter style font (Courier).
1)With a fixed font you will see 5 characters, with a proportional it will depend on the width of the characters
2)With a fixed font you will see 5 characters,with a proportional it will cause the field to expand to fit the text
3)The columns setting does not affect the number of characters displayed
4)Both will show exactly 5 characters
3。
You need to create a class that will store unique object elements. You do not need to sort these elements but they must be unique.
What interface might be most suitable to meet this need?
1)Set
2)List
3)Map
4)Vector
[此贴子已经被作者于2006-5-6 17:57:58编辑过]
----------------解决方案--------------------------------------------------------
第一题是4)
第二题是1)
第三题是1)
----------------解决方案--------------------------------------------------------
4。
You have created a simple Frame and overridden the paint method as follows
public void paint(Graphics g){
g.drawString("Dolly",50,10);
}
What will be the result when you attempt to compile and run the program?
1) The string "Dolly" will be displayed at the centre of the frame
2) An error at compilation complaining at the signature of the paint method
3) The lower part of the word Dolly will be seen at the top of the frame, with the top hidden.
4) The string "Dolly" will be shown at the bottom of the frame.
5.Which of the following can you perform using the File class?
1) Change the current directory
2) Return the name of the parent directory
3) Delete a file
4) Find if a file contains text or binary information
6.
You are using the GridBagLayout manager to place a series of buttons on a Frame. You want to make the size of one of the buttons bigger than the text it contains. Which of the following will allow you to do that?
1) The GridBagLayout manager does not allow you to do this
2) The setFill method of the GridBagLayout class
3) The setFill method of the GridBagConstraints class
4) The fill field of the GridBagConstraints class
7.
You are concerned that your program may attempt to use more memory than is available. To avoid this situation you want to ensure that the Java Virtual Machine will run its garbage collection just before you start a complex routine. What can you do to be certain that garbage collection will run when you want .
1) You cannot be certain when garbage collection will run
2) Use the Runtime.gc() method to force garbage collection
3) Ensure that all the variables you require to be garbage collected are set to null
4) Use the System.gc() method to force garbage collection
8.
Which of the following most closely describes a bitset collection?
1) A class that contains groups of unique sequences of bits
2) A method for flipping individual bits in instance of a primitive type
3) An array of boolean primitives that indicate zeros or ones
4) A collection for storing bits as on-off information, like a vector of bits
9.
Which of the following statements are true?
1) Methods cannot be overriden to be more private
2) Static methods cannot be overloaded
3) Private methods cannot be overloaded
4) An overloaded method cannot throw exceptions not checked in the base class
[此贴子已经被作者于2006-5-6 19:31:04编辑过]
----------------解决方案--------------------------------------------------------
我猜第4选1
为什么都是英文?
楼主,英语几级了!?
看来我今年是别想有好日子过了!
----------------解决方案--------------------------------------------------------
第四题 3)
第五题 2) 3)都正确
第六题 4)
第七题 1)
第八题 4)
第九题 1)
----------------解决方案--------------------------------------------------------
第4题为什么选3呀?
----------------解决方案--------------------------------------------------------
第7题的4为什么不对?
----------------解决方案--------------------------------------------------------
我也不明白第4为什么选3!
我是用翻译来看那道题的!不过也只有那道题翻译起来还读得懂!
其他都乱七八糟!
[此贴子已经被作者于2006-5-7 0:31:28编辑过]
----------------解决方案--------------------------------------------------------
第四题drawString方法的参数X,Y代表的是最左边字符基线的坐标 题中由于参数Y取值为10 即从Frame顶部 到基线只有十个象素的高度 完全有可能部分字符的上部被挡起来 只有字符的下部能显示出来 和3)描述的一样
第七题 考察的是垃圾回收站 程序员永远都不可能强制回收站工作 只能通知垃圾回收站 如置对象为null 什么时候回收内存取决于系统 具有不定性
建议楼主把最基础的知识掌握好
----------------解决方案--------------------------------------------------------
我不想再多说话了!
TMD!我都不知道该怎么说自己了!
第4是选3,可是为什么我会说选1就只能是那个时候我傻了!
----------------解决方案--------------------------------------------------------