Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Mock Exam Errata and the fly likes - Questions - Language Fundamentals Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark " - Questions - Language Fundamentals" Watch " - Questions - Language Fundamentals" New topic
Author - Questions - Language Fundamentals

Thiru Narayanan

Joined: Apr 30, 2001
Posts: 23
Question No. 17 of the Subject goes like this:
Which of the following are legal Java programs. Select all the correct answer.
D) package pkg;
import java.awt.*;
Option 'D' is also given as correct. If only these two lines are available in the source file in what name the file is to be saved? And how can it be compiled and run?
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Thiru,
An empty file is a valid Java program. The JVM only stipulates that the top-level class inside the file have the same name as the file itself (capitalization also). Since you have no class inside the file, the JVM performs no check; hence, no complaints!
Thiru Narayanan

Joined: Apr 30, 2001
Posts: 23
But my question was in what name the empty file is to be stored? I was thinking all along that you have to give a name to save a file.
Amit Madan
Ranch Hand

Joined: Dec 20, 2000
Posts: 32
you can give any name to it.
Don't get me started about those stupid light bulbs.
subject: - Questions - Language Fundamentals