Java - Interview Questions and Answers for 'Regex' | Search Java Interview Question -

Search Java Interview Questions

 2280 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text


Interview Questions and Answers for 'Regex' - 1 question(s) found - Order By Newest

 Q1. What's wrong with this code ?

public static void main(String[] args) {
String regex = "(\\w+)*";
String s = "Java is a programming language.";

Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(s);
while ( {
System.out.println("The e-mail id is: " +;
Core Java
Ans. matcher.find() should have been used instead of within while.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     java   regex   pattern.matcher   java.util   coding   code

Related Questions

  What are the steps to be performed while coding Junit with Mocking framework ?
  What is a Sequence File?
 What different level of logging you use while coding ?

Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner

comments powered by Disqus

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   

Questions Asked: