• Post Reply Bookmark Topic Watch Topic
  • New Topic

I just don't get this  RSS feed

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so. plain and simple i dont get what is wrong. not a clue heres my code:




so the problem is that, eclipse is telling me that line 14 and 15 have errors on them.... but there isnt anything a can see
 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse is, or if you were to try to compile the code you've posted, the compiler would be, telling you more than you're telling us. Helping you understand and overcome errors is easier if you see and post the complete error.
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, and welcome to the Ranch!

People will be better able to help you if you TellTheDetails(←click), such as copy/pasting the exact, complete error messages.

In this case, I can take a reasonable guess. Both error messages are probably telling you exactly what's wrong--that in one case you're trying to invoke a constructor that doesn't exist, and in the other you're trying to invoke a method that doesn't exist.

jlistm extends Object, and if you look at the docs for Object, you'll see that it doesn't have a c'tor that takes a String argument.

Similarly, you have not defined a setLayout() method on your jlistm class, and it's not inheriting any such method from its superclass (Object), so there is no such method on that class.

Does that give you a hint as to what you might have done wrong? (And note that I didn't tell you anything that wasn't in the error messages.)
 
levi sleight
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... wow, you said almost the exact thing the error message said. nice,
i was pretty dumb, didnt look close enough at my code. i forgot to extend the classs that
had the method i was using,i think. still gotta go back and relearn a lot of this stuff.
still dont quite get what a constructor does
 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
levi sleight wrote:still dont quite get what a constructor does

A constructor is a special block of code that gets executed when a new instance of the class is created. You normally use it to initialize the member variables of the object. See Providing Constructors for Your Classes in Oracle's Java Tutorials for more details.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!