• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

I just don't get this

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic