摘要:
public class CopyTextByBuf { public static void main(String[] args) { BufferedReader bufr = null; BufferedWriter bufw = null; try { bufr = new Buffere 阅读全文
posted @ 2020-04-10 23:49
hongxiao2020
阅读(289)
评论(0)
推荐(0)
摘要:
缓冲区的出现提高了对数据的读写效率。 缓冲区要结合流才可以使用。 在流的基础上对流的功能进行了增强。 该缓冲区提供了跨平台的换行符。newLine(); public class BufferedWriterDemo { public static void main(String[] args) 阅读全文
posted @ 2020-04-10 23:25
hongxiao2020
阅读(371)
评论(0)
推荐(0)
摘要:
public class CopyText { public static void main(String[] args) { copy_1(); } public static void copy_1() { FileWriter fw = null; FileReader fr = null; 阅读全文
posted @ 2020-04-10 22:25
hongxiao2020
阅读(255)
评论(0)
推荐(0)
摘要:
public class FileReaderDemo { public static void main(String[] args) throws IOException { //创建一个文件读取流对象,和指定名称的文件相关联 FileReader fr = new FileReader("de 阅读全文
posted @ 2020-04-10 17:55
hongxiao2020
阅读(287)
评论(0)
推荐(0)
摘要:
public class FileWriterDemo { public static void main(String[] args) { FileWriter fw = null; try { // 传递true,代表不覆盖已有文件,追加 fw = new FileWriter("demo.tx 阅读全文
posted @ 2020-04-10 16:27
hongxiao2020
阅读(955)
评论(0)
推荐(0)
摘要:
public class FileWriterDemo { public static void main(String[] args) { FileWriter fw = null; try { fw = new FileWriter("s:\\demo.txt"); fw.write("abcd 阅读全文
posted @ 2020-04-10 16:18
hongxiao2020
阅读(266)
评论(0)
推荐(1)
摘要:
字符流的抽象类:Reader,Writer 既然IO流是用于操作数据的,那么数据的最常见体现形式:文件 以文件演示。 创建文件,写入数据 public class FileWriterDemo { public static void main(String[] args) throws IOExc 阅读全文
posted @ 2020-04-10 16:06
hongxiao2020
阅读(257)
评论(0)
推荐(0)
摘要:
IO流用来处理设备之间的数据传输 java对数据的操作是通过流的方式 java用于操作流的对象在IO包中 流按照数据类型分为两种:字节流与字符流 流按照流向分为:输入流与输出流 字节流的抽象类:InputStream,OutputStream 字符流的抽象类:Reader,Writer 阅读全文
posted @ 2020-04-10 15:35
hongxiao2020
阅读(191)
评论(0)
推荐(0)
摘要:
public class MathDemo { public static void main(String[] args) { double d = Math.ceil(12.34); // 返回大于等于指定数据的最小整数 System.out.println(d); double d1 = Ma 阅读全文
posted @ 2020-04-10 15:12
hongxiao2020
阅读(264)
评论(0)
推荐(0)
摘要:
public class CalendarDemo { public static void main(String[] args) { Date d = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); String 阅读全文
posted @ 2020-04-10 14:50
hongxiao2020
阅读(237)
评论(0)
推荐(0)
摘要:
public class DateDemo { public static void main(String[] args) { Date d = new Date(); System.out.println(d);//打印的时间看不懂,希望有些格式 //将模式封装到SimpleDateFormat 阅读全文
posted @ 2020-04-10 13:25
hongxiao2020
阅读(180)
评论(0)
推荐(0)
摘要:
api文档中该类并没有提供构造函数。 说明不可以new对象。那么会直接想到该类中的方法都是静态的。 发现该类中还有非静态方法。 说明该类肯定会提供了方法获取本类对象。而且该方法时静态的,返回值类型是本类类型。 该方法是:static Runtime getRuntime(); public clas 阅读全文
posted @ 2020-04-10 13:05
hongxiao2020
阅读(237)
评论(0)
推荐(0)
摘要:
System类中的属性和方法都是静态的。 out:代表标准输出,默认是控制台 in:标准输入,默认键盘 getProperties:获取系统属性信息 java -Dpro=value class 在jvm启动时添加属性 public class Demo { public static void m 阅读全文
posted @ 2020-04-10 02:02
hongxiao2020
阅读(246)
评论(0)
推荐(0)
摘要:
当类名重名时,需要指定具体的包名。 当方法重名时,需要指定具体的对象或者类。 import java.util.Arrays; import static java.util.Arrays.*; import static java.lang.System.*; //导入System类中所有静态成员 阅读全文
posted @ 2020-04-10 01:17
hongxiao2020
阅读(430)
评论(0)
推荐(0)
摘要:
public class Demo { public static void main(String[] args) { show(2, 3, 4, 5, 6); } public static void show(int... arr) { System.out.println(arr.lengt 阅读全文
posted @ 2020-04-10 01:03
hongxiao2020
阅读(1418)
评论(0)
推荐(0)
摘要:
格式: for(数据类型 变量名: 被遍历的集合(Collection)或者数组) 只能取出,不能增删。 对集合进行遍历:只能获取集合元素。但是不能对集合进行操作。 迭代器除了遍历还能进行remove集合中元素的动作。 如何使用ListIterator还可以在遍历过程中对集合进行增删改查的动作。 传 阅读全文
posted @ 2020-04-10 00:50
hongxiao2020
阅读(1079)
评论(0)
推荐(0)

浙公网安备 33010602011771号