Shop
OBEX
P1 Docs
P2 Docs
Learn
Events
Constructor blues — Parallax Forums
toggle menu
Categories
Discussions
Sign In
·
Register
Sign In
·
Register
Categories
Discussions
Sign In
·
Register
×
Home
›
General Discussion
Constructor blues
Enrique
Posts:
90
2007-11-04 08:30
edited 2007-11-04 13:09
in
General Discussion
Hi,
·
I’m learning how to use constructors in Java. In the attached program I get an error message that points to the xyz=new Duck(); statement and I don’t know why. Can someone explain what’s going on?
·
·
Thanks,
·
Enrique
java
java
ConstSamp.java
294B
ConstSamp.java
294B
Comments
Peter Verkaik
Posts:
3,956
2007-11-04 10:37
edited 2007-11-04 10:37
You must define class Duck static eg.
public static class Duck {
·
...
}
regards peter
Enrique
Posts:
90
2007-11-04 13:09
edited 2007-11-04 13:09
Thanks
Sign In
or
Register
to comment.
Comments
public static class Duck {
· ...
}
regards peter