r/javahelp • u/MembershipOptimal514 • May 07 '26
Codeless What does static exactly do?
Hi, I’m somewhat new to java and I’m quite confused on static. So what I do know is that it makes it so a variable or method is tied to the whole class instead of just the object but I’m not sure what that exactly ENTAILS. Can someone explain it to me maybe with an example or such? Thank you.
15
Upvotes
View all comments
Show parent comment
1
u/Educational-Paper-75 May 08 '26
Well, I wasn't considering multithreaded apps beginners wouldn't know about anyway. I'm simply illustrating a possible use of static. But if that's a concern to the OP he may just use a static class instead that cannot be instantiated.