[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Hi guys, I'm just starting out coding in college and I can't

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 9
Thread images: 3

File: my main.png (20KB, 662x631px) Image search: [Google]
my main.png
20KB, 662x631px
Hi guys, I'm just starting out coding in college and I can't seem to find an answer for this.

So i've got a 2D array of type Being (which is my superclass, the subclasses are "fish" and "bear", and they require a name and X and Y locations for the 2d array.), and i want to print out the name at the location to display the 5x5 array i have.

However, when i do this it instead prints out the memory location instead of the name.
How can i fix this? I expect it to be printing "Alpha" at location [0][0].

Will post print method and superclass next.

Apologies if this isn't necessarily following G's rules, I don't ever post here, but I thought you guys would know.
>>
File: my superclass.png (20KB, 482x700px) Image search: [Google]
my superclass.png
20KB, 482x700px
Here is my superclass im calling from for the fish and bear subclasses.
They dont have any differences yet, except later on i will add that if a fish is put at the same location as a bear, it becomes null.
>>
>>58861974

You're not even putting the fish into the river, you're just saying they are fish

you need to say;

River[0,0] = new Fish("alpha,0,0);
River[1,2] = new Fish("fish2",1,2); etc..
>>
change majors
>>
File: fixed.png (27KB, 682x699px) Image search: [Google]
fixed.png
27KB, 682x699px
>>58862297
no i did set the location, i only did it for one of them though (Fish a, aka "alpha")

>>58862325
shut up nerd, i already fixed it.
>>
>>58862344
>i already fixed it
your major is saved! huzzah!
>>
>>58861974
install gentoo
>>
>>58862344
What is that fucking indentation on line 22 holy shit. Also fix the goddamn warnings, lint is there for a reason
>>
>>58861974
what the fuck are you doing OP
Thread posts: 9
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.