• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem printing out an object  RSS feed

 
Kevin Crossan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys new to the forum.

Also a complete Java n00b. More or less. I do have some understanding of the concepts.

So I'm messing about with this idea of `Objects.`
This is a piece of code I wrote myself so I can grasp the idea.





I think its returning some type of memory address. Imported@129c643.

I'm not sure I completely understand - returning methods, just looking again at this code. Like I had an idea why I wanted to return`area`
when I started writing this, now that I look at the code again; I'm not sure why I did. Sigh... I think I just need to ask a few questions,
that might seem stupid to you guys - if that would be ok?
 
Paul Clapham
Sheriff
Posts: 22215
38
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kevin, welcome to the Ranch!

You aren't the first newbie to be baffled by objects. Far from it! So go ahead and ask your questions, that's what the Ranch is all about.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36660
475
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Questions are good! Ask away!

Your object doesn't yet contain any variables so there aren't good options to have it print yet...
 
Kevin Crossan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the great welcome guys. Some people are funny about asking n00b00 questions, good to know you guys arent like that.
So I was taking into account what you said Jeanne. I think the problem is I'm trying to force together - calling methods and calling classes so I can understand the difference.

So this is the new code I'm working on at the moment. Taking everything into consideration.




It says it can't find the ImportedObject at line 15.

Also I didn't want to give areasum on line 13 any parameters (b,l)
I thought they should be left to line 15. The compiler made me put something in.

As I  understand line 11 and 13 :-
I've declared this ImportedObject in line 11
and made it the same thing that areasum is in line 13?

Would that be a correct understanding? 
 
Kevin Crossan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think I cracked it guys. Took a while, trying to over complicate it I think. Thanks for the nudge in the right direction Jenna. I've a much more complicated program, now operational, with input data and stuff. My uni doesn't use Scanner so I won't post the code. This was the a simple fix (although from a slightly different idea) just in case anyone stumbles across this thread in future. 


 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65900
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One additional thing to be mindful of is the Java naming conventions. Variables should always start with a lowercase letter.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!