Java Inheritance Question with Abstract

Java Inheritance Question with Abstract

von Mohammad Jeragh -
Anzahl Antworten: 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:
Als Antwort auf Mohammad Jeragh

Re: Java Inheritance Question with Abstract

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