Write a class called GreenAlien which has the following public attributes: an attribute called name of type
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a class called GreenAlien which has the following public attributes:
- an attribute called name of type String. This holds the Aliens name.
- an attribute called eyeCount of type int. This holds the number of eyes an Alien has.
- an attribute called favouriteCandy of type String. This holds the Aliens perceived favourite candy.
And Methods:
- getDescription, which returns the String: "This Alien is called and has eyes. Gross. It seems to enjoy eating ".
When you test your Class, make sure to have multiple instances of GreenAliens in your main() method. It's good to get used to having multiple objects of your code.
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: