Object-Oriented Java


#1

https://www.codecademy.com/courses/learn-java/lessons/object-oriented-programming/exercises/methods-2?action=lesson_resume&link_content_target=interstitial_lesson

in step no. 4 of instructions please make me clear that what do you want to say and why is that needed to print “Your dog ran 40 feet!” in the output window.



class Dog {
  
  int age;

    public Dog(int dogsAge) {
    
      age = dogsAge;
    
  }
  
  public void bark() {
        
    System.out.println("Woof!");
    
    }
    
  public void run(int feet) {
    
    System.out.println("Your dog ran " + feet + " feet!");

    }
  
    public static void main(String[] args) {
    
    Dog spike = new Dog(5);
    spike.bark();

    }

}


https://www.codecademy.com/courses/learn-java/lessons/object-oriented-programming/exercises/methods-2?action=lesson_resume&link_content_target=interstitial_lesson


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.