File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Boone's qns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Boone Watch "Boone New topic

Boone's qns

Amandeep Waraich
Ranch Hand

Joined: Jul 14, 2000
Posts: 56
Hi, I just took the Boone mock exam. I am just a little doubful about the following qns. Can anybody help me?
1. What will happen when you attempt to compile and run the following program by passing the Test class to the Java interpreter?
class Test {
public static void main() {
Select the one right answer.
1. The program does not compile because main() is not defined correctly.
2. The program compiles but when you try to run the interpreter complains that it cannot find the main() method it needs to run.
3. The program compiles but you cannot run it because the class is not declared as public.
4. The program compiles and runs without an error but does not display anything in the standard output.
5. The program compiles and displays "hello" in the standard output when you run it.
The answer given is 2, but I think the answer should be 3 (and also 2, if multiple answers are allowed).

Question 65: Which statements about garbage collection are true?
Select all valid answers.
a. You can directly free the memory allocated by an object.
b. You can directly run the garbage collector whenever you want to.
c. The garbage collector informs your object when it is about to be garbage collected.
d. The garbage collector reclaims an object´┐Żs memory as soon as it becomes a candidate for garbage collection.
e. The garbage collector runs in low-memory situations.
My answer is c, e, but the answer given is b,c,e. I don't think b is correct 'coz you can't run the garbage collector, you can only request it to be run. Any suggestions?

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
About the first question, What Boones says is right.
The following code will compile and run if you call it by
saying "java Test"
class Test {
public static void main(String args[]) {
The following code will compile and wont run
class Test {
public static void main() {

Note: The top level class could either be public or friendly.

About the following question,
"You can directly run the garbage collector whenever you want to."
-- I feel he tries to differentiate between "whether you could
run the garbage collector" and "whether it really collects any garbage or not". You might be able to run it when you want to but it collects garbage only when it wants to.
- This is my interpretation. Any takers ?
[This message has been edited by vasansrini (edited July 30, 2000).]
I agree. Here's the link:
subject: Boone's qns