Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38710
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2019-01-22 08:09 -0800 |
| Message-ID | <80e0e6bf-ef5a-4f3f-adf4-b5de4c6696ef@googlegroups.com> (permalink) |
| Subject | value of Math.abs(a), int a=null; |
| From | Akshay Goel <goelakshay001@gmail.com> |
Hi all,
In below code, how is the if statement working?
Integer closest = null;
for(int i = 0; i < n; i++) {
int current = in.nextInt();
if(closest == null || Math.abs(closest) > Math.abs(current)
|| Math.abs(closest) == Math.abs(current) && closest < current) closest = current;
}
System.out.println(closest);
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
value of Math.abs(a), int a=null; Akshay Goel <goelakshay001@gmail.com> - 2019-01-22 08:09 -0800 Re: value of Math.abs(a), int a=null; Arne Vajhøj <arne@vajhoej.dk> - 2019-01-22 11:20 -0500 Re: value of Math.abs(a), int a=null; Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-01-22 11:32 -0500
csiph-web