Analyze the source code of Java Access control

Source: Internet
Author: User
The code is as follows: Copy code
Import java. io. File;
Import java. io. FileOutputStream;
// Access control
Public class PolicyExample {
Public static void main (String [] args ){
Try {
// Write a file to c:/hello.txt
Byte [] info = "Hello, this is the test information". getBytes (); // defines the information written to the file
File testFile = new File ("c:/hello.txt"); // defines the File and outputs it to c:/hello.txt.
FileOutputStream fout = new FileOutputStream (testFile );
Fout. write (info); // write information to the file
Fout. close (); // close the output stream
System. out. println (testFile. getAbsolutePath () + "write successful ");
} Catch (Exception ex ){
Ex. printStackTrace ();
 }
 }
}
The code is as follows: Copy code
Attachment Download: http://down.111cn.net/down/code/jsp/2012/0320/24024.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.