This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm very much a beginner in Java and I've been asked to write a program to create graphs using data from several other files.
At the moment I'm trying to use SimpleGraph but I keep getting the error
'cannot find symbol - class SimpleGraph'
Does this mean I need to import something? or am I missing an important piece of software?
What is a SimpleGraph? I don't see any such class in the API, so where did this class come from?
It's really just about impossible to help you if you don't show us your actual code. You don't need to post ALL of it (especially if it is over about 40-50 lines). Just post enough to show us the problem.
And if you are having this kind of a problem, you shouldn't have more than 10-20 lines anyway.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Aug 23, 2011
SimpleGraph was something I found on online Java tutorials, but I can always try and use something else if this is inappropriate.
Here is my code, but ignore the comments as they're things I need to change once I've finished testing the graphs
I've added code tags to your post - it preserves formatting and makes it much easier to read. next time, after you paste in your source code, hilight it and click the 'code' button above. it's just like making text bold or italic.
That tutorial is for how to use a specific package of java code - you would have to download it and configure it to work. Basically, Someone has written a bunch of java, and bundled it into this package. One of the classed they created is this SimpleGraph class. For a first ever java project, this may be a little more than you are ready for. i'm not saying it can't be done, but as a first project...it is questionable. I'm afraid you might get frustrated before you even begin.
Finally, programming is all about being very precise. "simplegraph" is NOT the thing you found. You found something called "SimpleGraph". In java, the case matters, so these two things are not the same. Further, there are conventions everyone uses. Class names have the first letter of each word capitalized. Another java developer can look at "SimpleGraph" and know it refers to a class. If you write "simplegraph", a developer would think this was an instance variable name, but have no idea what the type is...
This may all seem minor to you, but if you are going to talk to other developers (and in that, I include your future self as at some point, you will come back to this code and have to look at it again), you should learn what is expected.