I want to learn java

Status
This thread has been locked.

LoopTurn

Deving
Premium
Feedback score
4
Posts
86
Reactions
19
Resources
0
Hello,

I need to learn a few basic parts of java that I am getting really confused about because I don't fully understand. If I could have someone please explain this to be over like a discord call this would be great. I am confused on how constructors and hashmaps work and the all-around using multiple classes because the tutorials I learned from shoved it all into 1 class. If you do request money I would not be paying much but I may consider paying if needed but I just can't understand this and I am really getting annoyed.
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Fluddershy

Feedback score
2
Posts
277
Reactions
133
Resources
0
I see you're basically at the same level I saw you on Spigot a year ago... Google is your best friend.

To answer your question because I'm a sucker, here is it:
Constructors are what is called when the class you're using it for is called. Say I have a class called LearnJava.
Code:
class LearnJava {
     public LearnJava() {
          System.out.println("This is called when you initialized the object");
     }
}
This here is the bare base of a class, and when using OOP this is very essential. Why would you want to do this? You set bare information and sooner or later make it more complex. Google OOP as well. Anyway, so if we ran the following code:
Code:
LearnJava lj = new LearnJava();
That would call the constructor because the () represent the constructor, and yes you can pass objects through that as well just like any other method.

HashMaps are key and value based. So say I have two players, one's name is Thing1 and the second is Thing2. We both put them in our little HashMap using the #put() method, and they are assigned a number.
Code:
Map<String, Integer> map = new HashMap<>();
map.put("Thing1", 1);
map.put("Thing2", 2);
So we put those in there, now if we retrieve them using Map#get() if they exist, they'll return something, if not it'll be null. If we do
Code:
map.get("Thing1");
it will return 1.
 

madk0ur

Music Producer
Premium
Feedback score
2
Posts
142
Reactions
26
Resources
0
Hello,

I need to learn a few basic parts of java that I am getting really confused about because I don't fully understand. If I could have someone please explain this to be over like a discord call this would be great. I am confused on how constructors and hashmaps work and the all-around using multiple classes because the tutorials I learned from shoved it all into 1 class. If you do request money I would not be paying much but I may consider paying if needed but I just can't understand this and I am really getting annoyed.
https://www.mc-market.org/threads/191001/page-17#post-2890349
 

Rj

PhD Candidate, Control Theorist
Supreme
Feedback score
7
Posts
730
Reactions
221
Resources
0
If you could spare like $15 check out udemy.
 

Clyde

Premium
Feedback score
44
Posts
1,574
Reactions
1,220
Resources
0
Derek Banas is my favorite free teacher on YouTube.
 
Status
This thread has been locked.
Top