⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 writefiledemo.java

📁 精通Java核心技术源代码
💻 JAVA
字号:
import java.io.*;

     public  class  WriteFileDemo
     {
	      public static void main(String arg[])  throws IOException
	      {
		 	byte[] somebyte = {'a','b','c'};
		 	String hello = "hello";
		 	FileOutputStream out = new FileOutputStream("data.tmp"); 
		 	if ( out != null )
		 	{
				System.out.println( "Begin to write to file" );
				out.write( somebyte );            
				String str = new String( somebyte,0 );
				System.out.println( "write bytes:" + somebyte +  " or write string:"+str );
				for ( int i = 0;i<hello.length();i++ )
			 		out.write( hello.charAt(i) );
				System.out.println( "write the string hello:" + hello );    
				out.close();
	    		}
       	  }
	  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -