nerdexam
Oracle

1Z0-804 · Question #58

The default file system includes a logFiles directory that contains the following files: Log-Jan 2009 log_0l_20l0 log_Feb20l0 log_Feb2011 log_10.2012 log-sum-2012 How many files does the matcher in…

The correct answer is B. Two. The pattern to match is ???_1? (regex "...._.1.") This means at least three characters before the symbol _ , followed by any amount of characters. The next tolast character must be 1. The last character can by any character. The following file names match this pattern: Trap !!…

NIO.2

Question

The default file system includes a logFiles directory that contains the following files:

Log-Jan 2009 log_0l_20l0 log_Feb20l0 log_Feb2011 log_10.2012 log-sum-2012 How many files does the matcher in this fragment match? PathMatcher matcher = FileSystems.getDefault ().getPathMatcher ("glob:

???_1?" );

Options

  • AOne
  • BTwo
  • CThree
  • DFour
  • EFive
  • FSix

How the community answered

(24 responses)
  • A
    8% (2)
  • B
    83% (20)
  • C
    4% (1)
  • F
    4% (1)

Explanation

The pattern to match is ???_1? (regex ".*..._.*1.") This means at least three characters before the symbol _ , followed by any amount of characters. The next tolast character must be 1. The last character can by any character. The following file names match this pattern: Trap !! l is not 1 !!

Topics

#PathMatcher#glob patterns#file matching

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice