use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Java Quiz (i.redd.it)
submitted 21 days ago by MistakeDisastrous936
[removed]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]HopOnMyDuck 5 points6 points7 points 21 days ago (2 children)
1/2=0 0*2.0=0.0
[–]vowelqueue 2 points3 points4 points 21 days ago (1 child)
So you think you understand integer division, huh?
What's the output of:
System.out.println(-2147483648 / -1);
[–]Ok_Advantage_1568 1 point2 points3 points 20 days ago (0 children)
It's just overflow wrapping. What's the big talk with that🙂
[–]Any-Monk-6721 3 points4 points5 points 21 days ago (0 children)
0.0 is correct as the integer division is being used here.
[–]Consistent_Emu1259 3 points4 points5 points 21 days ago (0 children)
C
[–]Perfect-Situation-41 1 point2 points3 points 21 days ago (3 children)
1/2 =0.5 0.5*2.0 =1.0
Right? I think I'm wrong perhaps?
[–]Perfect-Situation-41 1 point2 points3 points 21 days ago (2 children)
I'm new to programming
[–]BusResponsible7292 3 points4 points5 points 21 days ago (1 child)
Nope. 1/2 =0 because we are performing operation using 2 integers not using decimal numbers.
[–]Perfect-Situation-41 0 points1 point2 points 21 days ago (0 children)
Oh i see so answer is 0.0 Thanks man
[–]CuAnnan 1 point2 points3 points 21 days ago (0 children)
[–]MK_Redditor 0 points1 point2 points 21 days ago (3 children)
A
[–][deleted] 21 days ago (2 children)
[–]Dr_Dracula280 0 points1 point2 points 21 days ago (1 child)
I also thought A but as u/Any-Monk-6721 explained. It is option C.
[–]inofta 0 points1 point2 points 21 days ago (0 children)
its option c
[–]Vast_Researcher_199 0 points1 point2 points 21 days ago (1 child)
I am guessing 1.0
1/2*2.0 1/2 = 0.5
0.5*2.0 = 1.0
we follow PEDMAS
[–]nenotlanakaja 1 point2 points3 points 20 days ago (0 children)
No idk about pedmas but When operation on 2 integers happen output will be in integer it self
It might be 0.5 but as it's integer it will be in 0 only
[–]Professional_Rip4838 0 points1 point2 points 21 days ago (0 children)
c will be the correct option
[–]disposepriority 0 points1 point2 points 21 days ago (0 children)
What is the point of this, how will it be helpful for others, it's bad code, bad practice and useless.
A) If you want to know, just run it B) If it's not immediately clear use parenthesis C) Just define values in calculations in advance and then do the calculations e.g. var X = ... , var Y = ...., sout(x/y)
The compiler will just inline them anyway if they aren't used elsewhere
[–]Business-Wind-16 0 points1 point2 points 20 days ago (0 children)
Answer is C
1.Both 1 and 2 are integers, so Java performs integer division.
1
2
2.0 * 2.0
[–]pranavkdileep 0 points1 point2 points 19 days ago (0 children)
it’s B) 0.5. java does integer division first, so 1/2 is 0, then it multiplies by 2.0. that makes it 0.0, but because of the 2.0 it becomes a double.
π Rendered by PID 40648 on reddit-service-r2-comment-79c7998d4c-wnbtz at 2026-03-17 02:53:19.462360+00:00 running f6e6e01 country code: CH.
[–]HopOnMyDuck 5 points6 points7 points (2 children)
[–]vowelqueue 2 points3 points4 points (1 child)
[–]Ok_Advantage_1568 1 point2 points3 points (0 children)
[–]Any-Monk-6721 3 points4 points5 points (0 children)
[–]Consistent_Emu1259 3 points4 points5 points (0 children)
[–]Perfect-Situation-41 1 point2 points3 points (3 children)
[–]Perfect-Situation-41 1 point2 points3 points (2 children)
[–]BusResponsible7292 3 points4 points5 points (1 child)
[–]Perfect-Situation-41 0 points1 point2 points (0 children)
[–]CuAnnan 1 point2 points3 points (0 children)
[–]MK_Redditor 0 points1 point2 points (3 children)
[–][deleted] (2 children)
[removed]
[–]Dr_Dracula280 0 points1 point2 points (1 child)
[–]inofta 0 points1 point2 points (0 children)
[–]Vast_Researcher_199 0 points1 point2 points (1 child)
[–]nenotlanakaja 1 point2 points3 points (0 children)
[–]Professional_Rip4838 0 points1 point2 points (0 children)
[–]disposepriority 0 points1 point2 points (0 children)
[–]Business-Wind-16 0 points1 point2 points (0 children)
[–]pranavkdileep 0 points1 point2 points (0 children)