8.Methods:I Help?


#1

I have looked through the comments on this and tried several times now but this is still not accepting my code. Am I missing something?

MY CODE:

class Dog {
  
  int age;

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

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

    }

}

ERROR MSG: did you type the command correctly? Make sure it's inside the bark method.

ERROR CODE ON RIGHT: Dog.java:10: error: cannot find symbol
System.out.printIn("Woof!");
^
symbol: method printIn(String)
location: variable out of type PrintStream
1 error

Please can anyone advise? Thanks V much. :smile:


#2

im having the same problem and im getting the same error message.


#3

You have used printIn instead of println.


#4

Wow, can't believe I missed that. Thank you albionsrefuge for your help. :smiley:


#5

A post was split to a new topic: Stilll getting same error


#6

5 posts were split to a new topic: 8. Did you create a Dog object using the Dog constructor?


#7