-1

Why am I getting this error "class DuplicateItemException is public, should be declared in a file named DuplicateItemException.java", when I try to compile? Can anyone help me through this?

1
  • 1
    Because you didn't do what the error told you to do? If you want help, you will have to tell us why you think you don't deserve this messsage; is your class in a file with that name? Commented Sep 21, 2014 at 17:41

1 Answer 1

2

Java convention is that a class is placed in a file with the same name of the class, so I assume your class DuplicateItemException is not placed in a file named DuplicateItemException.java.

Sign up to request clarification or add additional context in comments.

1 Comment

Well, not "convention." It's a requirement. But, yes this.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.