aspose file tools*
The moose likes Beginning Java and the fly likes Can someone tell me what I am doing wrong? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can someone tell me what I am doing wrong?" Watch "Can someone tell me what I am doing wrong?" New topic
Author

Can someone tell me what I am doing wrong?

Alec Sultana
Greenhorn

Joined: Jan 02, 2012
Posts: 7
Hey guys,

I have my A level computing project coming up, and I am struggling. So hopefully I'll find some much needed help here

Anyway, I was writing this program, more so modifying. 2 classes. I seem to have a problem with the 3rd and 5th line of the tuna class. It worked fine when I wanted to pass on a String to what was Simplemessage. But then I decided to try something out, and use integers, furthermore calculating something simple.

Also can anyone tell me what these error codes mean, so that in the future I won't need to trouble you guys for the same problem

error: <identifier> expected
error: cannot find symbol

Any help appreciated,

Alec



Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

Welcome to the Ranch.

This line:

should have looked like this:

You have to specify the type (int in this case) for each argument separately. int fnum, snum doesn't work.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Alec Sultana
Greenhorn

Joined: Jan 02, 2012
Posts: 7
Jesper de Jong wrote:Welcome to the Ranch.

This line:

should have looked like this:

You have to specify the type (int in this case) for each argument separately. int fnum, snum doesn't work.


Thank you, thats all I needed

Man I'm bad at this
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38405
    
  23
You ought to go through the code conventions (those are very old, and many people use a different indentation convention.)

You have some strangely-named classes: what have tuna and addition to do with each other? Avoid two declarations in the same line; fnum and snum each deserve a line to themselves.
Alec Sultana
Greenhorn

Joined: Jan 02, 2012
Posts: 7
Campbell Ritchie wrote:You ought to go through the code conventions (those are very old, and many people use a different indentation convention.)

You have some strangely-named classes: what have tuna and addition to do with each other? Avoid two declarations in the same line; fnum and snum each deserve a line to themselves.


True, But I have been watching a lot of TheNewBoston's videos on youtube, and he always uses those two class names in his video examples, so for the sake of making me remember the appropriate syntax of things, I decided to use the same name. ( For my revision and playing with code only though )
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38405
    
  23
You want to get used to doing things right from day 1. If you get into bad habits now (or, more precisely, since you have got into bad habits already), they are so much more difficult to break when you are writing what matters. And style problems will lose you marks.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11243
    
  16

IMHO, variable names like "fnum" and "snum" should be avoided. Fred's number? Favorite number? Fine Number?

You have a keyboard, you have plenty of memory and disk space..."firstNumber" makes it obvious what you are talking about.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can someone tell me what I am doing wrong?