*
The moose likes Beginning Java and the fly likes Issues with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Issues with "cannot find symbol" (Resolved)" Watch "Issues with "cannot find symbol" (Resolved)" New topic
Author

Issues with "cannot find symbol" (Resolved)

Jon Kho
Ranch Hand

Joined: Jun 03, 2009
Posts: 54
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

Joined: Sep 29, 2008
Posts: 12617

There's got to be more to the problem than this; what's the "Video" class?
Jon Kho
Ranch Hand

Joined: Jun 03, 2009
Posts: 54
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

Joined: Apr 13, 2009
Posts: 96
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

Joined: Jun 03, 2009
Posts: 54
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

Joined: Apr 13, 2009
Posts: 96
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

Joined: Jun 03, 2009
Posts: 54
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

Joined: Jun 03, 2009
Posts: 54
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issues with "cannot find symbol" (Resolved)
 
Similar Threads
Static method
Dynamic dispatch
how to work with interface in java?
"-1 if this list does not contain the element." problem using arraylist
Problem with loop funcation related with arraylist's .size()(Resolved)