8. Did you create a Dog object using the Dog constructor?


#1

class Dog
{
int age;

public Dog( int dogsAge)
{
age = dogsAge;
}
public void bark()
{
System.out.println("WOOF!");

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

}

}

Error MSG
Did you create a Dog object using the Dog constructor? Make sure you indicate an integer parameter. Use the example to help you.
I have tried it several times but this is not working .. Can anyone solve this problem ?????


8.Methods:I Help?
#2

remove the space between Dog and (4)

should be like

Dog spike = new Dog(4) ;





Always create new topic.Dont post on other's topic.


#3

rcodeman till getting same error


#4

Can any solve this problem???


#5

did you try it after refresh/reload your browser?


#6

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