Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Problem in regex Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Problem in regex" Watch "Problem in regex" New topic
Author

Problem in regex

Sidharth Khattri
Ranch Hand

Joined: Sep 16, 2013
Posts: 122

Question is from CertPal
Though I've read about invocation of useDelimiter() on Scanner, but I don't know about Scanner.delimiter() and I couldn't find it.
It's used in this program(highlighted with a comment).
Does scanner.delimiter() return an instance of Pattern? If yes, what is the argument in that Pattern's instance?
I only knew the following way to instantiate Pattern:
Pattern p = Pattern.compile("\\d");



OCPJP 6 - 96%
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19533
    
  42

Sidharth Khattri wrote:
Though I've read about invocation of useDelimiter() on Scanner, but I don't know about Scanner.delimiter() and I couldn't find it.


Generally, the javadoc is a good place to start, when searching about methods -- see java.util.Scanner. And yes, it returns the pattern that is being used as a delimiter.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Sidharth Khattri
Ranch Hand

Joined: Sep 16, 2013
Posts: 122

Henry Wong wrote:
Sidharth Khattri wrote:
Though I've read about invocation of useDelimiter() on Scanner, but I don't know about Scanner.delimiter() and I couldn't find it.


Generally, the javadoc is a good place to start, when searching about methods -- see java.util.Scanner. And yes, it returns the pattern that is being used as a delimiter.

Henry


Thank you Henry. Really appreciate your help
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Problem in regex