Today I'm learning about IO in java. When I look at
lineSeparator string in
BufferedWriter class I saw the statement
lineSeparator = java.security.AccessController.doPrivileged(
which initialize the
lineSeparator string. But I don't find
class in java source. So I get confused how java uses this class which is not in java source. So tell me:
- where this classes is defined and how
JVM call this class ?
- Can we call this class in our own program ?
Best How To :
Java has this class you can see from here, but you shouldn't use sun(now oracle package at your code) source here the reason of why shouldn't use it. And the meaining of
The code that uses doPrivileged says "Give me the value of the property, if the current class (where this line of code is in) is allowed to read it."
here there is another discussion to understand it better
EDIT : It is under your JDK Program Files\Java\jdk1.8.0_25\jre\lib\rt.jar you can learn rt.jar details