LearnFrenzy
Sign in Take a free test

Java Basics, Syntax and Data Types · Java Basics MCQ · Question 6

File name and public class Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 6 Back to Exercise

A file contains public class Invoice { … }. What must the file be called?

  • A Main.java
  • B Invoice.java Correct
  • C invoice.java (any case)
  • D Any name ending in .java
Correct Answer: Option B

The name must match exactly, including case. A file may contain at most one public top-level class.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links