mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zanninso
2632926739
|
1 year ago | |
---|---|---|
.. | ||
README.md | 1 year ago |
README.md
StarInheritance
Instructions
Create a new class Star
in a file named Star.java
.
This class inherits from CelestialObject
. We add a private double property magnitude
, with public getter and setter.
Usage
Here is a possible ExerciseRunner.java to test your function :
public class ExerciseRunner {
public static void main(String[] args) {
Star star = new Star();
System.out.println(star.getName());
System.out.println(star.getX());
System.out.println(star.getY());
System.out.println(star.getZ());
System.out.println(star.getMagnitude());
}
}
and its output :
$ javac *.java -d build
$ java -cp build ExerciseRunner
Soleil
0.0
0.0
0.0
0.0
$