Multiple choice technology programming languages

Given a part of code tell the output(Assume that the code is perfect ie no compiler error or runtime exceptions) Pattern p=Pattern.compile("\d+"); Matcher m=p.matcher("345678"); while(m.find()) { System.out.print("-"+m.group()+"-"); }

  1. -345678-

  2. -3--4--5--6--7--8-

  3. -3--34--345--3456--34567--345678-

  4. -345678--345678--345678--345678--345678--345678--345678-

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The regular expression \d+ matches one or more consecutive digits. The input string '345678' consists entirely of digits, so m.find() matches the entire string as a single group. The loop runs once, printing '-345678-'.