0

I have read the some tricky interview question i have seen this i couldn't understand what is the logic behind this . Can some one explain ?

public class Test
{
    public static void main(String[] args) {
for(char c‮h = 0; c‮h < Character.MAX_VALUE; c‮h++)
    if (Character.isJavaIdentifierPart(c‮h) && !Character.isJavaIdentifierStart(c‮h))
            System.out.printf("%04x <%s>%n", (int) c‮h, "" + c‮h);
    }
}

OutPut

0000 < >
0001 <>
0002 <>
0003 <>
0004 <>
0005 <>
0006 <>
0007 <>
0008 <>
000e <>
000f <>
0010 <>
0011 <>
0012 <>
0013 <>
0014 <>
0015 <>
0016 <>
0017 <>
....more rows
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
soorapadman
  • 4,451
  • 7
  • 35
  • 47
  • 1
    I'd post a compilable example first; this isn't even code yet. Looks like something is supposed to be in a string, but even then, something's missing. – Dave Newton May 17 '17 at 14:56
  • Thanks for reply. this is what the program it is . – soorapadman May 17 '17 at 14:57
  • I'd recommend you check the java documentation on the methods being used and then it should make sense. – Ousmane D. May 17 '17 at 14:57
  • 3
    @DaveNewton It compiles. http://ideone.com/iP3HWq – tnw May 17 '17 at 14:57
  • 1
    Because of the unprintable chars, which are invisible here. My point is that without doing analysis the question is non-sensical, and the OP did none of that. – Dave Newton May 17 '17 at 15:01
  • 1
    Not a u-turn at all-what was missing was due diligence on the OP's part, at least IMO. – Dave Newton May 17 '17 at 15:06
  • @DaveNewton not digilenge person like u con't understand at first sight . im beginner has no clue of what is going on . The question also raised by of the high reputation person(peter-lawrey) in SO . Unfortunately he didn't clearly explain. So i don't think it easy. if con't answer better quite . Don't criticize no one knows everything – soorapadman May 18 '17 at 04:21

1 Answers1

0

this:

for(char c‮h = 0; c‮h < Character.MAX_VALUE; c‮h++)

is the same as

for(char ch=0; ch< Character.MAX_VALUE; ch++) 

but is written backwards.... so is a normal for loop

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97