3/13 Error


#1


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

Did you create a Dog constructor? Use the example to help you.

Dog.java:11: error: class, interface, or enum expected
public static void main(String[] args) {
^
1 error


//Create a custom Dog class
 class Dog {

	//The class constructor for the Dog class
  
	public Dog () { 
		}
 }
    

public static void main(String[] args) {
  
}


#2

//Create a custom Dog class
class Dog {

public Dog () { 
	}

}

public static void main(String[] args) {

}

I changed my code to this, and it allows me to continue on to the next exercise, but im still getting this error for some reason, even though it says I've done it correctly in the check list.


error message:
Dog.java:10: error: class, interface, or enum expected
public static void main(String[] args) {
^
1 error


#3

This method needs to be inside the class body.

class Dog {

    public Dog () {

    }

    public static void main(String[] args) {

    }
}

#4

THANK YOU! That worked :slight_smile:


#5

I happened to delete my comment line

//The class constructor for the Dog class

and then it worked!!! So Frustrated


#6

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