java简单学习笔记20181217

异常的处理,try--catch--finally结构,finally里的代码总是会执行,当try里有return语句执行前时,也总是要执行finally的。

自定义exception类,extends继承自Exception类,无参和有参数的构造函数,super(msg)

语句异常throw手动抛出异常。

方法声明里说明有可能产生异常用throws,如:public void test() throws IOException{}.................

I/O输入、输出类,File类表示文件或者是目录,File.isFile(),File.isDirectory()判断,一些方法,File类的创建,new File(string path,string filename),或者File(File dir,string Filename),其他方法,file.getName(),file.listFiles(),file.canread(),file.canwrite(),file.mkdir(),file.delete()

随机文件类RandomAccessFile类,构造方法RandomAccessFile(string file,string accmode),RamdomAccessFile(File file,string accmode),

访问方法seek(),getFilePoint(),skipBytes(int n),writeChars(string s),WriteInt(int n),readChar(),readInt().....

猜你喜欢

转载自www.cnblogs.com/lofe/p/10134676.html