2013年11月13日
    
 
        
        
摘要:        
总结:BufferedReader。InputStreamReader.字节与字符的区别。package com.ds;import java.io.*;//从控制台输入字符串,输到sdd时停止输入public class yuiy {	public static void main(String[] args) throws Exception { BufferedReader b = new BufferedReader(new InputStreamReader(System.in)); String s;// 字符串、结果:输入字符串 System.out.println("    
阅读全文
 
        
            posted @ 2013-11-13 20:19
juewang
阅读(176)
推荐(0)
        
            
        
        
摘要:        
总结:read()方法返回类型是int型??不知道该怎么用好循环》package com.da;import java.io.*;public class fgbv {	public static void main(String[] args) throws IOException { BufferedReader bb = new BufferedReader(new InputStreamReader(System.in)); char c; System.out.println("enter a line"); do { c = (char) bb.read();     
阅读全文
 
        
            posted @ 2013-11-13 07:52
juewang
阅读(168)
推荐(0)
        
            
        
        
摘要:        
总结:输入流、输出流。。子类多。需要加强:package com.da;import java.io.*;public class rtr {	public static void main(String[] args) { File file=new File("dfad.txt"); OutputStream ops=null; try{ ops=new FileOutputStream(file,true);//是否追加 String a="fasdf is my "; byte []b=new byte[1325]; for(byte temp:    
阅读全文
 
        
            posted @ 2013-11-13 00:35
juewang
阅读(319)
推荐(0)
        
 
		
    
        
            
        
         
        2013年11月12日
    
 
        
        
摘要:        
总结:这个程序很容易懂。的那是这个结果我觉得有问题啊。。怎么“stop”后,输出的内容是输入过的呢?应该是没有关系的呀,与输入的值是不同的。。。。怎么书上运行的结果和我的不一样啊package com.badu;//把文本每一行存入数组,读取到100行//这一行并没有说是字节数组。所以字符串对应的是字串数组import java.io.*;//读取到100行即停止public class rie {	public static void main(String[] args) throws IOException { BufferedReader bu = new BufferedReade.    
阅读全文
 
        
            posted @ 2013-11-12 22:00
juewang
阅读(203)
推荐(0)
        
            
        
        
摘要:        
总结:读取到的是字节型转换成字符串。 package com.c2;import java.io.*;public class tkrp {	public static void main(String[] args) throws IOException { File F = new File("fsa.txt"); FileInputStream fis = new FileInputStream(F);// 以字节流形式读取文件 BufferedInputStream buf = new BufferedInputStream(fis);// 以缓冲读取文件字节 Bu    
阅读全文
 
        
            posted @ 2013-11-12 07:36
juewang
阅读(288)
推荐(0)
        
 
		
    
        
            
        
         
        2013年11月11日
    
 
        
        
摘要:        
总结:package com.aini;import java.io.*;import java.util.StringBuffere;public class tyt {	public static String reader1(String pathname) throws IOException { String line = System.getProperty("line is a"); BufferedReader reader = null; FileReader read = null; try { read = new FileReader(new Fil    
阅读全文
 
        
            posted @ 2013-11-11 23:16
juewang
阅读(287)
推荐(0)
        
            
        
        
摘要:        
package com.aini;//流类rr//流操作的步骤:/*1.找到指定File 2.实例化字节流、InputStream/OutputStream/Reader/Writer 3.读/写文件 4.关闭文件*/import java.io.*;public class yitop {	public static void main(String[] args) { String c = null; BufferedReader bf = null; BufferedWriter bw = null; try { bf = new BufferedReader(new Inp...    
阅读全文
 
        
            posted @ 2013-11-11 22:04
juewang
阅读(238)
推荐(0)
        
            
        
        
摘要:        
在java中使用IO操作必须按照以下的步骤完成:使用File找到一个文件使用字节流或字符流的子类为OutputStream、InputStream、Writer、Reader进行实例化操 作进行读或写的操作关闭:Close(),在流的操作宏最终必须进行关闭    
阅读全文
 
        
            posted @ 2013-11-11 19:25
juewang
阅读(240)
推荐(0)
        
            
        
        
摘要:        
总结:Throwable 是所以异常的父类。error和Exception是继承它的类Exception:这类异常一般是外部错误,例如试图从文件尾后读取数据等,这并不是程序本身的错误,而是在应用环境中出现的外部错误。2.Error是比较严重的错误,一般程序不处理这种错误,Exception是程序应该处理的异常。异常分为普通异常和运行时异常,运行异常我们可以不处理,让虚拟机管它。普通异常我们必须用try{}catch(){}finally{}package com.b;//对于异常若不想在方法里捕获,可以在方法声明的时利用*throws*声明进行抛出,//返回类型 方法名 throws 异常..    
阅读全文
 
        
            posted @ 2013-11-11 15:52
juewang
阅读(853)
推荐(0)
        
            
        
        
摘要:        
总:异常的产生!!!!异常如何实现,继承~~~package com.b;//我不懂为什么这里的异常一定要来自于父类。子类。去继承它。因为Exception是Throwable类的子类异常类。而自定义异常是本身不存在的。方法肯定要来自于//统计水位过高的异常 //Exceptionpublic class MyException extends Exception {	MyException(String s) { super(s);	}	// 这里是子类的静态方法	public static void met...    
阅读全文
 
        
            posted @ 2013-11-11 15:17
juewang
阅读(543)
推荐(0)