摘要: /** * Date重写了toString()方法,用一个字符串来描述当前Date对象所表示的时间。 * 例如: Mon Feb 17 15:36:55 CST 2014 * 实际上Date的toString()方法返回的字符串虽然很清晰的描述了时间, * 但是对于非英语地区来将,该字符串不够友好, 阅读全文
posted @ 2016-04-30 16:24 安仔80 阅读(290) 评论(0) 推荐(0) 编辑
摘要: /** Date类常用API: 概念: Java中的时间使用标准类库的Date类表示,是用距离一个固定时间点的毫秒数(可正可负,long类型) 表达一个特定的时间点。 固定的时间点叫纪元(epoch),是UTC时间1970年 1月 1日 00:00:00。 UTC(Universal Time Co 阅读全文
posted @ 2016-04-30 16:06 安仔80 阅读(650) 评论(0) 推荐(0) 编辑
摘要: * 用户输入商品生产日期和保质期(天数),通过程序计算促销日期。 * 计算规则为:到保质期前14天所在周的周三为促销日。 /** * 用户输入商品生产日期和保质期(天数),通过程序计算促销日期。 * 计算规则为:到保质期前14天所在周的周三为促销日。控制台交互情况如图-1所示 * 思路: * 1. 阅读全文
posted @ 2016-04-30 15:46 安仔80 阅读(4515) 评论(1) 推荐(0) 编辑
摘要: /** * 要求在控制台输入一个计算表达式: * 例如: * 51+52 (加减乘除法) 按回车出计算结果: * 103 * * a+1 按回车出如下提示: * 不是数学计算表达式 * 以下等有空在研究 * 1+2*3+(3+4)= * * 3*5+1/2 */ public class Work0 阅读全文
posted @ 2016-04-30 15:43 安仔80 阅读(433) 评论(0) 推荐(0) 编辑
摘要: /** * 字符串排序 * 练习代码, 给定字符串" nba" "cba" "ncaa" "wba" ... 要求: 不用Collections.sort方法,Collections.sort方法 /** * 对象比较大小compare的用法 字符串排序 * 练习代码, 给定字符串" nba" "c 阅读全文
posted @ 2016-04-30 15:21 安仔80 阅读(184) 评论(0) 推荐(0) 编辑
摘要: /** * "In the entire world there's nobody like me. *Since the beginning of time, there has never been another person like me. *Nobody has my smile. *N 阅读全文
posted @ 2016-04-30 15:19 安仔80 阅读(896) 评论(0) 推荐(0) 编辑
摘要: /** * 删除一个目录或文件的方法 * */ public class FileTest { public static void main(String[] args) { File dir = new File("a"); //删除a目录 delete(dir); //补充delete方法 S 阅读全文
posted @ 2016-04-30 15:17 安仔80 阅读(403) 评论(0) 推荐(0) 编辑
摘要: /** * 删除一个目录或文件的方法 * */ public class FileTest { public static void main(String[] args) { File dir = new File("a"); //删除a目录 delete(dir); System.out.print... 阅读全文
posted @ 2016-04-30 15:12 安仔80 阅读(277) 评论(0) 推荐(0) 编辑
摘要: /** * 复制文件 * 1.一次读取一个字节,用循环不断读取到没有字节可读 * 2.循环体内,一次写一个字节. 3.完成复制 总结: 但是复制大文件,这样的方法,效率底下 */ public class CopyDemo1 { public static void main(String[] args) throws IOExcepti... 阅读全文
posted @ 2016-04-30 15:11 安仔80 阅读(213) 评论(0) 推荐(0) 编辑
摘要: RandomAccessFileDemo3 向文件中写出一组字节的方法 /** * 文件操作 RandomAccessFile * * RandomAccessFile提供了一个可以向文件中写出一组字节的方法: * void write(byte[] bytesArr) 将给定的字节数组中所有字节一 阅读全文
posted @ 2016-04-30 15:10 安仔80 阅读(420) 评论(0) 推荐(0) 编辑