• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issues with "cannot find symbol" (Resolved)

 
Jon Kho
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I am stuck on this problem.. it seems that I am unable to create new object from parent. it gives me this error message..

cannot find symbol
symbol:constructor Show()
location: class Show


Currently I am using two classes called Show and Main(use to run it to display the functions)



I also noticed that the only different is between my class called "Customer" is showed below..

public Customer()
public Show(int showid, String showtitle, String showreview )


I am guessing the values in "Show" class is giving me problems..

Any comments or help on this will be great.. thanks!!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's got to be more to the problem than this; what's the "Video" class?
 
Jon Kho
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Opps.. I entered the wrong class name for it.. it's not "Video" but "Show".. anyway, i have updated the topic. In fact, I tried the solution from this topic -> http://www.coderanch.com/t/402221/Java-General-beginner/java/Compiler-Error-cannot-find-symbol but it is not working for me...

Thanks

Regards,
Jon
 
John Kimball
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java does NOT create the default no-args constructor if you specify a constructor of your own.

Hence, the problem with this line:


 
Jon Kho
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Kimball wrote:Java does NOT create the default no-args constructor if you specify a constructor of your own.

Hence, the problem with this line:



Thank you for commenting on this topic. But I wanted to pass the values from the arraylist shown below...

and
not like this...


Thanks.

Regards,
Jon
 
John Kimball
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're free to define more than one constructor in show.

Or define listShow as static and change how you call listShow.
 
Jon Kho
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Kimball wrote:You're free to define more than one constructor in show.

But instead, try defining listShow as static--I can't see any reason for it being an instance method--and change your main as follows:

Hi John,

it shows the message like this when i tired your method... "non-static method listShow() cannont be referenced from a static context"
Now i am trying out to use another class to perform what i wanted. Anyway, thanks for your comment.

Regards,
Jon
 
Jon Kho
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I have managed to resolved this issue with my friend's help. I will try to explain in lament terms...
Previously what I am try to do is to pass the values from Show class to Main class.. Now I added in another class so it looks like this...
Show--> ShowList --> Main.
The new class "ShowList" contains the ArrayList Values that is passed on from the "Show" class and has a method called displayList(). So what I is did, I placed the code "Show.displayList()" on the main class.. and it is able to prints out the results that I wanted and making my codes more neat too.

Thanks.

Regards,
Jon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic