aspose file tools*
The moose likes Beginning Java and the fly likes newb-array problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "newb-array problem" Watch "newb-array problem" New topic
Author

newb-array problem

Dario Nujic
Greenhorn

Joined: Jul 29, 2012
Posts: 2
So I'm working towards my Java 5/6 associate exam and doing practice questions. I came across this problem, I have the way I did and and the way it should be done. Just need to know why the right way is right.
the "shirt class"



What i had to do was create a ShirtArrayTest class and compile both. this is my ShirtArrayTest class



Panagiotis Kalogeropoulos
Rancher

Joined: May 27, 2011
Posts: 99

Why not have a closer look again at shirts[1].displayInformtation(); ? Can you see anything strange?
Dario Nujic
Greenhorn

Joined: Jul 29, 2012
Posts: 2
DAMN IT!! lol..besides that, should it work the way I had it,minus spelling mistakes, and which way is better and why ?

and thanks for the quick reply and look thru
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 560
@Dario - please keep your line lengths to a reasonable length, 80 columns being about the max. It makes reading the post and replies a lot easier.

Thanks!


Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Panagiotis Kalogeropoulos
Rancher

Joined: May 27, 2011
Posts: 99

thanks for the quick reply and look thru


No problem!

DAMN IT!!


Dont worry, it happens all the time. Just keep an eye on the results from the compiler. They will guide you on what the problem is and most of the times on the solution too.

If you fix the spelling mistake, it should work without any problems. Regarding your question on which way is better, I would say... it depends! Using the first approach, you write less code, which is good if you don't want to do lots of things with your objects. Using the second approach, you write more code (not always a bad thing, because it improves readability). So, in our case where you simply want to invoke one method, the first approach should be ok. But if you wanted to do more with the objects stored in your table, you should follow the second approach.

Hope the above helped you a little bit.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: newb-array problem