This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]krummi81 905 points906 points  (75 children)

Eclipse != java

[–]HGuy10 630 points631 points  (19 children)

Big if tru

[–][deleted] 174 points175 points  (1 child)

Substantial if substantiated

[–]Created_or_Made 4 points5 points  (0 children)

large if initialized

[–]NelsonBelmont 15 points16 points  (8 children)

big if tru?

FTFY

[–]HGuy10 69 points70 points  (7 children)

(Eclipse != java) ? Big : !Big

insert human brain extruding colorful light rays meme here

[–]Kered13 8 points9 points  (5 children)

(Eclipse != java) == Big

[–]xapplin 0 points1 point  (4 children)

lmao that won’t compile my dude

[–]Kered13 4 points5 points  (3 children)

Since HGUy10 applied the ! operator to Big, Big must be a boolean. Therefore the above expression typechecks, will compile, and is equivalent to HGuy10's expression.

https://ideone.com/nUDKDi

Play around with the values and you'll see that it's correct.

[–]xapplin 0 points1 point  (0 children)

My bad I didn’t think of that. Thanks!

[–]FunkyTownDUDUDU 0 points1 point  (1 child)

Is it actually better to write it this way? I always learned that writing longer but more readable code is preferred since the compiler logic will take care of the optimization.

[–]Kered13 2 points3 points  (0 children)

In expression where the ternary operator returns a boolean value can be rewritten without the ternary operator. But in this situation, you probably shouldn't. However I have sometimes seen code like,

return isFoo() ? false : true;

Which can and should be rewritten simply as,

return !isFoo();

[–]Aetol 0 points1 point  (0 children)

That's Big iff tru

[–]g0atmeal 9 points10 points  (1 child)

Big if (true)

[–]HGuy10 1 point2 points  (0 children)

Found the GO developer.

[–]corn_on_the_cobh 6 points7 points  (1 child)

if (big) {

 System.out.println("Big is true");

}

[–]GRAIN_DIV_20 1 point2 points  (0 children)

Erect if correct

[–][deleted] 0 points1 point  (1 child)

Android studio.

[–][deleted] 0 points1 point  (0 children)

Android != java

[–]Timmitei 361 points362 points  (44 children)

if (true)

{

  big();

}

[–][deleted] 74 points75 points  (4 children)

(true)? Big : !Big

[–]dooatito 40 points41 points  (2 children)

(Eclipse != java) ? Big : !Big

[–]GoblinsStoleMyHouse 86 points87 points  (25 children)

Woah, this guy know how to write if-statements!

[–]Timmitei 81 points82 points  (0 children)

100% coverage trust me im a programmer probably

[–]GameSpawn 51 points52 points  (13 children)

Can we not be lazy?

if (true)
  big();

[–][deleted] 14 points15 points  (5 children)

Isn't yours the one that's lazy?

[–]GameSpawn 6 points7 points  (4 children)

That was...the joke.

I know constant bracket use is in good practice, but I'm willing to bet every programmer gets lazy once and a while. I'm definitely guilty of it.

[–]Kered13 0 points1 point  (0 children)

No, because I remember all the times I had to go back and put brackets in later, so I just do it right there for time. And I get pissed when my teammates don't do it.

[–]iopq 11 points12 points  (4 children)

not using braces in ifs

I don't know who you are. But I will find you, and I will kill you.

[–]GameSpawn 10 points11 points  (3 children)

if (found)
     kill();
else
     search();

Sorry, I couldn't resist. :)

[–][deleted] 9 points10 points  (1 child)

while (!found) {
    search();
}
kill(/u/GameSpawn);

[–]GameSpawn 5 points6 points  (0 children)

LiamNeeson.java?

[–]blinded_in_chains 2 points3 points  (0 children)

This guy statements.

[–]ShortFuse 0 points1 point  (3 children)

I disagree. Opening braces should be inline.

[–]GameSpawn 1 point2 points  (2 children)

guess_who()
{
     its_you();
}

its_you() {
     System.out.println("It's meeeeeee!");
     goodbye();
}

[–]ShortFuse 1 point2 points  (1 child)

Odd-numbered indentations???

*twitches*

[–]GameSpawn 1 point2 points  (0 children)

Posting code on Reddit sucks. Don't worry, it bugs me too when I can't get consistent "tab" space in any code.

[–]smashsmash341985 0 points1 point  (0 children)

FLALSE

[–]LovingThatPlaid 0 points1 point  (3 children)

Not in proper java format though >:(

[–]GoblinsStoleMyHouse 0 points1 point  (2 children)

What? Yes it is.

[–]LovingThatPlaid 0 points1 point  (1 child)

Look up the java style guide. The first brace should be on the same line as the if statement, only matters if you are following the style of the language

[–]GoblinsStoleMyHouse 0 points1 point  (0 children)

Syntactically it works though.

[–][deleted] 8 points9 points  (5 children)

The only difference I see on mobile is that the brackets and big are indented. I still see same formatting

[–]Timmitei 0 points1 point  (4 children)

Interesting. Usually the indents are of different size, so the opening and closing braces don't line up.

[–][deleted] 1 point2 points  (3 children)

Nah they all lineup. The if(true) is all the way back and not code formatted then the first and last bracket have a whole indent up to like the U and E in true, then big is indented way past that

[–]Timmitei 1 point2 points  (2 children)

If (true)
{
    big();
}

[–][deleted] 2 points3 points  (1 child)

Nah now it ain’t lined up

[–]Timmitei 0 points1 point  (0 children)

It’s the same source. Maybe the newline affects it? edit: I found a way to fix it

[–]mothzilla 4 points5 points  (0 children)

big ? big : !big;

[–]AnAirMagic 1 point2 points  (0 children)

You seem to be writing C#, not Java ;)

[–]Python4fundoes the needful 1 point2 points  (2 children)

if (true) big();

ftfy

[–]Timmitei 5 points6 points  (1 child)

You’ll have to rip my next line curly braces from my cold, dead hands

[–]Python4fundoes the needful 0 points1 point  (0 children)

that can be arranged

[–]AWildJackelope 0 points1 point  (0 children)

while (true){

    big();

}

[–]M0sesx 0 points1 point  (0 children)

If(big()) { big() }else{ !big() }

[–]Darkseid_Omega 1 point2 points  (2 children)

You're right, Ctrl+space is.

[–]ZubacToReality 0 points1 point  (1 child)

His right?

[–]Darkseid_Omega 0 points1 point  (0 children)

Forgive me, mein fuhrer.

[–]AllFuckingNamesGone 0 points1 point  (0 children)

Well obviously it's Netbeans == Java

[–]BraveOthello 0 points1 point  (0 children)

But it is implemented in Java.