+ 3

y is it a valid declaration in java: int f=1_0;

I found a question in challenge which asked me to select all valid declarations in Java. I didn't select 'int f=1_0;' n hence I got the answer wrong. When I checked the answer, int f=1_0; was also chosen n my oppent had also chosen it.

26th Jun 2017, 7:54 AM
kars
kars - avatar
2 odpowiedzi
+ 2
thankya
26th Jun 2017, 8:54 AM
kars
kars - avatar
+ 1
The _ is a digit separator in Java, just as , is in natural language outside Europe at least, where they use . instead of ,. It was introduced in Java 7 if I recall correctly. so, in the question, f=10.
26th Jun 2017, 8:38 AM
Venkatesh Pitta
Venkatesh Pitta - avatar