![]() |
What is wrong with this code?
public class Dog extends Mammals {
public Dog(String name, String type) { super(name, type); } public String sound{ System.out.println("Hello"); } } Syntax error. Insert ";" to complete FieldDeclaration. The error appears under "sound" which is underlined with the error |
Is sound supposed to be a method? You're missing the () if it is.
Otherwise, Java thinks its a property called sound which needs to be semi-colon terminated. Java will accept a class level static block such as this: PHP Code:
|
OH! I knew it was something small. I feel dumb right now lol.
|
| All times are GMT +1. The time now is 09:59 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.