0

Recently I was improving my understanding on Regular Expressions by reading Mastering Regular Expressions Third Edition by Jeffrey E. F. Friedl, there is mentions Java has had a native regex package . Can some one please explain me what kind of java packages are known as native ?

Attaching image for reference.

enter image description here

ernest_k
  • 44,416
  • 5
  • 53
  • 99
Divya Gupta
  • 21
  • 1
  • 1
  • Have you try google already? Regex and Java posts and pages are quite abundant. You are expected to do some research before posting questions in StackOverflow. – Guilherme Mussi Jun 07 '18 at 13:57
  • This is an inaccurate statement. The `native` keyword is applicable to the methods only. Perhaps, he meant that all the methods of classes were `native` so he stated that the package itself is native. I suggest you to look for more `native` methods if interested. Take a look on `Math.java` class. – Nikolas Charalambidis Jun 07 '18 at 13:57
  • @Nikolas Exactly how many native methods are in `java.lang.Math`? – lexicore Jun 07 '18 at 14:12
  • I just create a program and type `import java.util.regex.Matcher;`. So it is native. – SedJ601 Jun 07 '18 at 15:08
  • @lexicore: No method at all - it’s a place to start exploring. These methods are not native but vast majority of them indirectly refer to theirs native implementations - that’s why I suggest to start there and u derstand the whole context. – Nikolas Charalambidis Jun 07 '18 at 15:32
  • 1
    @Closers The question is pretty clear and well formulated. – lexicore Jun 07 '18 at 16:59
  • @Nikolas It's just a bit strange that you suggest to lok for more `native` methods and point to `java.lang.Math` which hase zero `native` methods. – lexicore Jun 07 '18 at 17:00
  • @lexicore: I gave you my explanation. Perhaps, I chose the wrong words and made you misunderstood my intent. – Nikolas Charalambidis Jun 07 '18 at 17:02
  • In this context, it just means that the package comes with the JDK already included and there are no additional packages or JARs that you need to download and install, like you do for `javax.servlet` or Java EE packages. Even `javax.xml` and `java.util.logging` used to be separate packages that you had to download, but now they come 'native' with the JDK installation. Usually any useful packages are rolled into the JDK and come pre-installed, similar to how Microsoft buys companies and puts the features into the Windows OS. – Chloe Jun 07 '18 at 18:52
  • This question is perfectly clear to a native English speaker who knows Java history, but I'll still vote to leave closed because it's not a very useful question. – Chloe Jun 07 '18 at 18:54

1 Answers1

2

Native in this case means packages which are built-in or provided by the JRE. I.e. packages for which you don't need to import additional libraries.

This is not to be mistaken with native methods.

The usage of the work native in the first sense is not normative. That is, JLS does not provide this definition. It's more colloquial.

lexicore
  • 42,748
  • 17
  • 132
  • 221