Is it a shit language?
Only if you're an epic memer on /gee/
>>54467572
>>54467134
Delete this thread, please.
>>54467572
It's too verbose, i have no idea what every function really does
>>54467606
This
I just finished learning it and it takes 4 lines for what takes 2 one word in Python
>>54467595
>not understanding what this thread is about
>>54467606
how's it better than C++ in that regard?
it's pretty designated
>>54467572
It's not that Java is a bad language.
It's that Java lends itself to writing bad code.
More specifically it lets you write working (but bad) code that interacts with other working (but probably bad) code you've never paid attention to.
This is the called "the OOP paradigm", and employers like it because it lets them add or remove barely competent people from projects with minimum hassle.
IDK OP, it's pretty easy.int rValue = calculateHighScore(1500);
displayHighScorePosition("gary", rValue);
rValue = calculateHighScore(900);
displayHighScorePosition("Geodude", rValue);
rValue = calculateHighScore(400);
displayHighScorePosition("Metts", rValue);
rValue = calculateHighScore(50);
displayHighScorePosition("Gayrbo", rValue);
public static void displayHighScorePosition(String playername, int position){
System.out.println(playername + " got into position "
+ position + " on the highscore table.");
}
public static int calculateHighScore(int playerscore){
if(playerscore >= 1000){
return 1;
} else if(playerscore >=500 && playerscore <1000){
return 2;
} else if(playerscore >=100 && playerscore < 500){
return 3;
} else
return 4;
}
>>54467828
That if else forest is kinda sloppy. Clean up your act bro.
>>54467922
IntelliJ reformatted it like that but I'm trying to get better. ;_;public static int calculateHighScore(int playerscore) {
if (playerscore >= 1000) {
return 1;
} else if (playerscore >= 500
&& playerscore < 1000) {
return 2;
} else if (playerscore >= 100
&& playerscore < 500) {
return 3;
} else
return 4;
}
>>54467976
I don't care about the formatting. The logic is sloppy. You're checking for stuff twice and that's redundant.
>>54468004
pls teach me
>>54467572
Having a class for every little fucking thing sucks
>>54468068
1. There is no need for [else] if you're returning from the method. Just if if if if if is enough.
2. If the first if fails then you can assume playerscore is < 1000. There is no need to check for that again. Same for the other ifs.
3. The most common score should be the first if so that the method runs as fast as possible. This optimization is optional.
>>54467583
/thread
As an opsman, I dislike how much RAM it ends up using every time I see it deployed. That might be more of what I see deployed rather than Java itself. With that said, it gives far more tools for inspecting its heap than, say, NodeJS.
Java is a bad language. Why?
>Null pointer errors
>Most clunky syntax ever
>Its an AbstractFactoryAbstractThreadFactory kinda bullshit
>Eats all your ram
>stupid high spin up time
>lambda's are clunky
>option sum types are stupid, and still don't prevent null pointers
>aspect oriented programming is the new GOTO
>function overriding is brain damage
Basically if I had you java source code you don't know how it behaves unless you know the entire code base. Your methods will be overriden. A logger maybe summoned from the fucking void to log every instance to a AbstractFactory. Inheritance means you'll have a class with no discernible data that just overrides a shit load of methods so you'll read its damn source code wonder where all this shit comes from.
>>54467572
Yes, even setting it up on a fresh install of ubuntu is aids.
>>54467976public static int whatTheFuckIsThisEverUsefulFor(int playerscore) {
if (playerscore < 100){ return 4;}
if (playerscore < 500){ return 3;}
if (playerscore < 1000){ return 2;}
return 1;
}
>>54467572
Bloated as fuck.
>>54467572
I don't hate it, I just don't like it. It's the oatmeal of languages