About Question com.enthuware.ets.scjp.v6.2.116 :
Moderator: admin
About Question com.enthuware.ets.scjp.v6.2.116 :
Shouldn't it be \\d\\d instead of \d\d in the question?
-
- Site Admin
- Posts: 10075
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.116 :
No, \\ is required only when you specify the \d in java code.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 5
- Joined: Mon Aug 19, 2013 4:49 am
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.116 :
Just a question in proper code standards.
The code
Is actually setting in the while loop constantly the b.
Is it not better code use to do the following?
The code
Code: Select all
Pattern p = Pattern.compile(args[0]);
Matcher m = p.matcher(args[1]);
boolean b = false;
while(b = m.find())
{
System.out.println(m.start()+" "+m.group());
}
Is it not better code use to do the following?
Code: Select all
Pattern p = Pattern.compile(args[0]);
Matcher m = p.matcher(args[1]);
while(m.find())
{
System.out.println(m.start()+" "+m.group());
}
-
- Site Admin
- Posts: 10075
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.116 :
Yes, it would be better
Paul.
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: Bing [Bot] and 16 guests