Java Inheritance Question with Abstract

Java Inheritance Question with Abstract

de Mohammad Jeragh -
Número de respuestas: 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
Marcas:
En respuesta a Mohammad Jeragh

Re: Java Inheritance Question with Abstract

de 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.