• 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

The constructor List(String) is undefine

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hiii every body, at the moment I still try make my hand dirty with java code. Actually I'm now practice code provide by this web site. It's Code Barn. Now, I'm doing tutorial "HelloThreadTwo" code. There is some error at there, I check it so many times but still not find the solution for this error. The error is "the constructor List(String) is undefine". The statement that make error is this statement:

myList = new List("Thread info goes here");

I think I already define it on the top like provided example.
The statement that define the constructor is :

private List myList;

Can anybody explain me about this. Is it my error or the code provide by this web site wrong. That's all from me. Tq.
 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct the java.awt.List class does not have a constructor that takes in a String.

You should replace this line with

myList = new List();

It should fix that compile error.
 
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then call add method to add a string:

myList.add("Thread info goes here")
 
Akmal Zahdi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Manual Moon and KJ Reddy.
After I modify the code what u're ask me to write.

Then some error happen ..the statement make error is

myList.addItem( Thread.currentThread().getName() + " is running" );

and

myList.addItem( Thread.currentThread().getName() + " is done" );

I discard word Item....It's running.

I wonder Is it good for me to follow up the tutorial in there. I hope the admin for this site double check the provided tutorial here.
 
I'm doing laundry! Look how clean this tiny ad is:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic