aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes SCJP 5.0 objective 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "SCJP 5.0 objective 3" Watch "SCJP 5.0 objective 3" New topic
Author

SCJP 5.0 objective 3

Ravith Botejue
Greenhorn

Joined: May 25, 2005
Posts: 6
can somone explain to me about the regular expressions and how greedy, reluctant, possesive quantifiers work, also the new locale class and the printf() method.


RB
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
You might read MZ's SCJP Tiger Notes to dig out the answers.

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3233
    
    7
Originally posted by Nicholas Cheung:
You might read MZ's SCJP Tiger Notes to dig out the answers.

Nick


Thanks, Nick !

The direct link is : http://java.boot.by/scjp-tiger/ch03s05.html

regards,
MZ


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
Philip Heller
author
Ranch Hand

Joined: Oct 24, 2000
Posts: 119
For regular expressions, check out the API page for java.util.Scanner. Also Chapter 8 of the 5.0 rev of "Complete Java 2 Certification". Here's an example, reprinted with author's permission



The output is:

bcd
fgh
jkl

See how the vowels have been used as delimiters?

For more richly-defined pattern matching, you can use the quantifiers * + and ?. * matches zero or more occurrences of the preceding string. So "(ab)*" matches an empty string, "abab", "abababab", and so on. The + quantifier matches one or more occurrences, and the ? quantifier matches zero or one occurrences.

In certain arcane situations, it's hard to decide when a quantifier should stop matching. Should it match the longest possible string, or should it match something shorter? A greedy quantifier, which is the only kind covered in the exam, is the simplest: it matches the longest possible string. Reluctant and possissive quantifiers stop short of the longest match, using subtle algorithms that fortunately are WAY beyond the scope of the SCJP exam.

The Locale class is used for formatting text whose appearance depends on the part of the world where the text will be read. A simple example involves floating-point numbers. In the US and much of Asia, pi is written as 3.14159. But in many European countries the decimal "point" is actually a "comma", and pi is written as 3,14159. The following code prints pi, using the current machine's default locale:



The first string arg describes the format: a floating-point number occupying 7 characters, with 5 of those characters to the right of the decimal point/comma. I live in the US, so my output is "3.14159".

You can specify a locale like this:



Now the output is "3,14159".

Locales are especially good for formatting numbers, dates, and currency. These are all things that vary a lot from one locale to another. Again, there's more about this in the new "Complete Java 2 Certification".


Consultant to SCJP team.<br />Co-designer of SCJD exam.<br />Co-author of "Complete Java 2 Certification Study Guide".<br />Author of "Ground-Up Java".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SCJP 5.0 objective 3