2011-07-04 37 views
0

我:如果水珠語法{}表示的Java NIO.2水珠問題

Path path = Paths.get("Foo.class"); 
Path path2 = Paths.get("Foo.java"); 

FileSystem fs = FileSystems.getDefault(); 
PathMatcher matcher = fs.getPathMatcher("glob:*.{class, java}"); 

matcher.matches(path); // TRUE 
matcher.matches(path_2); // FALSE 

爲什麼path2是假的,它匹配的.class或的.java?

從JDK documentation

* {Java中,類}匹配文件名以.java結尾或的.class

回答

5

這是因爲在class, java

空間