10/13 Dog Java stuck in this lesson forever


#1



https://www.codecademy.com/en/courses/learn-java/lessons/object-oriented-programming/exercises/methods-2?action=resume

I tryid everything. I renew page 10 Times, restart browser, restart PC. I even copied right code for this lesson from other post on forum, still didnt work.
Please, somebody, help!!

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();
spike.run(40);

}

}


#2

1) first write public void run(){}
2)secondly an int parameter inside the parentheses saying int feet
3)thirdly write System.out.println("Your dog ran"+feet+"feet!") inside the brackets of the method
4)then inside the main call run method on the spike object nd inside the parentheses put an int value of your choice and it would look something like spike.run(an int parameter of your choice);


#3

Thank you very much!
I am scared to go to the next lesson, becaus bugs almost in every lesson(((


#4

Hi! I have the same problem as yours;

The instruction says: "1.
In between the bark and main methods, add a method called run to the Dog class by typing:"

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(12);
spike.bark();
spike.run(10);
}

}

It shows an error.... I didn't get it!


#5

I still cant figure out how to get past it. This is quite dumb.


#6

normally I can solve the whole set of instructions, click run once and move on, this exercise did not recognize instruction 1 as being complete, but everything else worked!
To get around the buggy instructions, delete some of your work, do instruction 1 only, and run.

then solve the rest and run again.


#7

Hi, I found restarting the exercise helped resolve the issue.

  1. If you haven't already done so, copy and paste your code into a text file.
  2. Restart the exercise
  3. Repeat each step by adding the code back in and running it.

To be honest the debugging tool is not great and I am finding trying to complete the exercises very frustrating


#8

This worked, thank you. This console is frustrating :frowning:

normally I can solve the whole set of
instructions, click run once and move on, this exercise did not
recognize instruction 1 as being complete, but everything else worked!
To get around the buggy instructions, delete some of your work, do instruction 1 only, and run.

then solve the rest and run again.


#9

class Dog {

int dogAge;

public Dog(int age) {

    dogAge = age;

}

public void bark() {
    System.out.println("Woof!");
}

public void run(int feet) {

    System.out.println("Your dog run " + feet + " feet!");

}

public static void main(String[] args){

   Dog spike = new Dog(4);
    spike.bark();
    spike.run(10);
 
}     
}

Guys my code is working but i still find error message

#10

I have the same problem as yours,but I did this,then it Correct。
class Dog{
int age;
public Dog(int dogsAge){
age=dogsAge;

}

public void bark(){
System.out.println("Woof!");

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


#11

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