Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Pieterjan Espeel
3,656 PointsJava.util.Map issue
In principle the thing i set out to do (to create a username and password database) works but I want to organize my code more into different classes. While doing this I have an issue accessing a Map in another class and i can't seem to find the reason why ...
Console output
users size: 0
Enter your username: Test Enter your password: 123
users size: 1 users size: 0 (<---- these are to test if the Loader class is picking up the value of the key i entered )
Welcome to my very first Prototype BattleShip game 'test' :) !!
Enjoy!!
Try 1, Enter an X and a Y coordinate (like this) <12>(with numbers from 0-4):
Code:
Prompter Class:
https://gyazo.com/2a6a810872196fe717b37f62feca57d3
https://gyazo.com/771bd240e7022fbdcec3041a003615a4
Loader Class:
https://gyazo.com/91c74bf8c8d3552d1016d187a823376d
Ps: Thanks in advance for helping me out !!
Pieterjan Espeel
3,656 PointsThe images should be readable if you zoom in.
Gustavo Winter
Courses Plus Student 27,382 PointsHi Pieterjan, please try to create a SnapShot with the code. This way i'll be easier to help you.
Pieterjan Espeel
3,656 PointsHere you go: https://w.trhou.se/1iwe8pyhuf
1 Answer
Gustavo Winter
Courses Plus Student 27,382 PointsOk, let's do it.
Let me understand the problem, i run the app and i don't see any problem initialize.
What map do you want access and from where the access will be make?
Pieterjan Espeel
3,656 PointsI want to access the map users in the prompter class through the loader class.
I added a bit of test code to see if the loader class was picking it up , but it keeps displaying a size of 0 and it is not saving the value in the userMap txt.
markmneimneh
14,133 Pointsmarkmneimneh
14,133 Pointsincredibly hard to read the images in the urls you posted.