Results 1 to 2 of 2
  1. #1
    lmhelp2 is offline Member
    Join Date
    Apr 2010
    Rep Power

    Question Specific syntax? java.util.regex.Pattern$Node


    Thank you for reading my post :) .

    I was considering the following package: "java.util.regex",
    when I met the following thing:
    Java Code:
    - static class: [B]Pattern.Node[/B]
    - java.util.regex.[B]Pattern$Node[/B]
    and also for instance:
    Java Code:
    - static final class: [B]Pattern.Begin[/B]
    - java.util.regex.[B]Pattern$Begin[/B]
    => I am wondering what is that "dollar character" that appears above in
    "Pattern$Node" or "Pattern$Begin".
    Is this "$" character a character like any other one?
    Or is it a specific construct... ?

    => What is "Pattern.Begin"?
    Is it the name of a class with a dot character right in the middle of it?

    => Why do we have those two distinct forms of what appears to be the
    same thing "Pattern.Begin" and "Pattern$Begin"?

    Thank you for helping me.
    All the best,

  2. #2
    lmhelp2 is offline Member
    Join Date
    Apr 2010
    Rep Power


    Hi again,

    Someone in my office gave me a hint: "nested classes", "inner classes".
    Ref. Nested Classes (The Java™ Tutorials > Learning the Java Language > Classes and Objects)

    Apparently, "Begin" would be an inner class of the class "Pattern"
    which would be the outer class for "Begin".

    We probably write "java.util.regex.Pattern$Begin" instead of
    "java.util.regex.Pattern.Begin" not to think "java.util.regex.Pattern"
    is a package name with a class "Begin" inside...


Similar Threads

  1. How to get value of specific child node
    By sito42 in forum New To Java
    Replies: 1
    Last Post: 07-13-2009, 12:00 PM
  2. How "Pattern.matches(regex, input)" function works?
    By kishan in forum Advanced Java
    Replies: 2
    Last Post: 04-26-2009, 12:46 AM
  3. Regex Pattern/Matcher - Print only one occurrence!
    By racha0601 in forum Advanced Java
    Replies: 3
    Last Post: 04-06-2009, 05:05 PM
  4. Replies: 2
    Last Post: 11-08-2008, 10:40 AM
  5. Regex pattern
    By ravian in forum New To Java
    Replies: 4
    Last Post: 12-11-2007, 10:20 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts