This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Mock Exam Errata and the fly likes Java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Reply Bookmark "Java" Watch "Java" New topic
Author

Java

Jit Som
Greenhorn

Joined: Jul 04, 2000
Posts: 1
Jaworski (http://www.jaworski.com/java/certification/) has a question like
In order of MyProgram to be compiled & run, which are true?
Athe MyProgram class must be defined in MyProgram.java
BMyProgram must be declared public
CMyProgram must have a correctly formed main() met.
DMyProgram must import java.lang
and the answre is only B.
is not A also correct?
Savithri Devaraj
Ranch Hand

Joined: Jun 26, 2000
Posts: 103
Not necessarily, because the class could be defined in a package along with other classes, right??
Savithri
kusuma janardhana
Greenhorn

Joined: Jul 06, 2000
Posts: 7
in a package,only one class can be public.and that class name is used to name the file.so,...i think 'a' is also correct.what do u say?
Maha Ravi
Greenhorn

Joined: Sep 25, 2000
Posts: 2
Hi,
I think C should be the only condition.
-Maha
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
It is not C because you don't have to have a main like with applets. It is not D because you don't have to import java.lang.
Now for A and B. I would think 'A' would be true because the question says in order to run and compile MyProgram. If you are running MyProgram then you would have to have it in a file MyProgram.java, correct? When I tried doing this, I got a NoClassDefFound runtime error. As for 'B', I don't think B is correct because a class can be a 'friendly' class and still compile and run. It can't be private or protected, but it can be 'friendly' or public. So I would have said only 'A' is correct.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Java
 
Similar Threads
Finished my program but have a big problem
CONDITIONS
class question
Need to run the Java program in the background
Discuss the answer of a scjp concern run the program.