Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Thomas Phillips Teacher: Mrs.Regan
- // CS2 Animal
- public class Program {
- public static void main(String[] args) {
- @SuppressWarnings("unused")
- int age;
- @SuppressWarnings("unused")
- String name;
- @SuppressWarnings("unused")
- Animal Jim , Sally;
- age = 17;
- name = "James";
- Animal Jim1 = new Animal();
- Jim1.type = "Dog";
- Jim1.color = "Pink";
- Jim1.feet = 4;
- Jim1.canFly = false;
- Jim1.message = "Woof";
- Jim1.speak();
- Sally = new Animal();
- Sally.type = "Fox";
- Sally.color = "Purple";
- Sally.feet = 4;
- Sally.canFly = false;
- Sally.message = "What does the fox?";
- Sally.speak();
- }
- }
- class Animal {
- String type;
- String color;
- int feet;
- boolean canFly;
- String message;
- public void speak() {
- System.out.println(message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement