Holy fuck, I just learned that all class members in Java are not private by default, they are "package-public"...

Holy fuck, I just learned that all class members in Java are not private by default, they are "package-public". What the fuck is this bullshit! Now I have to type "private" all over my code like a fucking idiot.

Just create multiple packages.
/thread

>like a fucking idiot.
/thread
But java is garbage anyway.

Sup Forums is not your personal blog

Use Kotlin instead

Better than working at a job where literally everything is public because your boss and co-workers don't understand what private means...

And you can't do anything about it

no

if you remove the class modifier the class is package-public too
at least it's consistent

>Now I have to type "private" all over my code like a fucking idiot.
damn... if only one could automate that with a computer...

WTF I thought you are not supposed to private all the shit. Keep it public unless you need?

it's the other way around actually

how's your command line tic tac toe comming along ?

java isn't an especially good language anyway

holy shit you should learn what a pointer is

You've got it backwards, user.

A principle of OOP, encapsulation, is that things should be made as accessible as necessary.
Make everything private by default. If you need access to it down the line, open access just as much as necessary.

private > protected > package (no modifier) > public

Ok in all honesty, what benefits does this add other than preventing spaghetti code (which happens when working with Pajeets anyway). Linters make me make everything private, and when I need it later I have to go back to that class and make a getter for it...

>A principle of OOP, encapsulation, is that things should be made as accessible as necessary.
[javik_face.png]
a pointless exercise

>a pointless exercise
how's that?

...

that would make his tiny brain explode

>2017
>not falling for the kotlin meme

let me guess, you are one of those "self-taught" programmers ?
it's one of the first things explained in every java book.

Package public comes in handy when you're writing unit tests.

Is there any downside in keeping them public, even if you aren't going to use them