<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at.>
<In what way does your code behave incorrectly? Include ALL error messages.>
```
class Dog {
int age;
public Dog(int dogsAge) {
age = dogsAge;
}
public static void main(String args) {
Dog spike = new age(12);
}
}.
<do not remove the three backticks above>
I keep getting this error, Did you create a Dog object using the Dog constructor? Make sure you indicate an integer parameter. i can seem to find were i have gone wrong.
Dog spike = new age(12);
//wrong
creating a Dog object using Dog constructor
Dog spike = new Dog(12);
I’m getting the same error:
class Dog {
int age;
public Dog(int dogsAge) {
age = dogsAge;
}
public static void main(String[] args) {
Dog spike = new Dog (5);
}
}
Screengrab
I think it’s because you have a space between brackets and dog. Try
Dog spike = new Dog(5);
1 Like
donmsed is right! remove space
ovalman
August 31, 2016, 10:40pm
#7
Thanks guys,
Is this just a quirk of this Java console? Should I report is as a bug?
system
closed
September 7, 2016, 10:40pm
#8
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.