Java Inheritance Question with Abstract

Java Inheritance Question with Abstract

by Mohammad Jeragh -
Number of replies: 2

I have the following two class 

public abstract class Animal{

....

}

public Dog extends Animal {

...}


I get the following error

__tester__.java:1: error: class Animal is public, should be declared in a file named Animal.java
public abstract class Animal {
                ^
If I remove the public from the Animal class it will work. How can I force into multiple files.

Thank you in advance 
Please Help
Tags:
In reply to Mohammad Jeragh

Re: Java Inheritance Question with Abstract

by Richard Lobb -

Assuming you're a teacher and are using a reasonably up-to-date CodeRunner version you should be able to configure the question to allow one or more .java attachments. Then students can submit their answers by pasting the main class into the answer box and adding support classes as attachments. The attachments are all loaded into the working directory as separate files.

In reply to Richard Lobb

Re: Java Inheritance Question with Abstract

by Mohammad Jeragh -
Thank so much for your answer. And yes I am faculty member.