java学习笔记
rock林
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
对象一对一关系
package class1; class Person { private String name ; private int age ; private Book book ; public Person(String name , int age){ this.setName(name) ; this.setAge(age) ; } public void setName(翻译 2017-09-04 17:25:23 · 330 阅读 · 0 评论 -
克隆
package class1; class PersonD implements Cloneable { private String name = null ; public PersonD(String name) { this.name = name ; } public void setName(String name) { this.name = name ; } pu翻译 2017-09-09 09:37:16 · 166 阅读 · 0 评论 -
二叉树
package class1; class BinaryTree { class Node { private Comparable data ; private Node left ; private Node right ; public void addNode(Node newNode) { if(newNode.data.compareTo(this.data) if翻译 2017-09-09 10:00:05 · 187 阅读 · 0 评论 -
观察者模式
package class1; import java.util.Observable; import java.util.Observer; class House extends Observable { private float price ; public House(float price) { this.price = price ; } public float g翻译 2017-09-09 10:33:47 · 190 阅读 · 0 评论 -
时间调度
package class1; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Timer; import java.util.TimerTask; class MyTask extends TimerTask { public void run() { SimpleDateFor翻译 2017-09-09 10:57:11 · 582 阅读 · 0 评论 -
字符流输出
package class1; import java.io.File; import java.io.FileWriter; import java.io.Writer; public class WriterDemo01 { public static void main(String[] args) throws Exception{ File f = new File("d:"翻译 2017-09-09 13:10:02 · 171 阅读 · 0 评论 -
字符流读入
package class1; import java.io.File; import java.io.FileReader; import java.io.Reader; public class ReaderDemo01 { public static void main(String[] args) throws Exception{ File f = new File("d:"翻译 2017-09-09 13:14:23 · 199 阅读 · 0 评论 -
字节流读入
package class1; import java.io.File; import java.io.FileInputStream; import java.io.InputStream ; public class InputStreamDemo05 { public static void main(String[] args) throws Exception{ File f翻译 2017-09-09 13:23:57 · 193 阅读 · 0 评论 -
字符流输出
package class1; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; public class OutputStreamDemo03 { public static void main(String[] args) throws Exception { Fil翻译 2017-09-09 13:28:05 · 219 阅读 · 0 评论 -
管道流
package class1; import java.io.IOException ; import java.io.PipedInputStream; import java.io.PipedOutputStream; class Send implements Runnable { private PipedOutputStream pos = null; public Send翻译 2017-09-09 13:54:09 · 191 阅读 · 0 评论 -
System.out
package class1; import java.io.IOException; import java.io.OutputStream; public class SystemDemo01 { public static void main(String args[]){ OutputStream out = System.out;//屏幕输出、如果是FileOutputStre翻译 2017-09-11 09:17:45 · 542 阅读 · 0 评论 -
printStream格式化输出
package class1; import java.io.File ; import java.io.FileOutputStream ; import java.io.PrintStream ; public class PrintDemo0 { public static void main(String args[]) throws Exception { PrintStre翻译 2017-09-11 09:19:15 · 440 阅读 · 0 评论 -
标准键盘输入BufferedReader
package class1; import java.io.BufferedReader ; import java.io.IOException ; import java.io.InputStreamReader; public class BuffereReaderDemo01 { public static void main(String args[]) { Buffere翻译 2017-09-11 10:45:34 · 378 阅读 · 0 评论 -
Scanner
//方式一 package class1; import java.util.Scanner; public class ScannerDemo01 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("输入数据:"); String翻译 2017-09-11 11:19:18 · 413 阅读 · 0 评论 -
数据流
package class1; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; public class DataOutputStream1 { public static void main(String args []) throws Exception{翻译 2017-09-11 12:43:20 · 247 阅读 · 0 评论 -
合并流
package class1; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.io.SequenceInputStream;翻译 2017-09-11 13:16:13 · 229 阅读 · 0 评论 -
java环境变量设置
1、JAVA_HOME=java安装目录 2、CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar 3、PATH=%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;原创 2017-09-02 17:51:07 · 213 阅读 · 0 评论 -
数字格式化
package class1; import java.text.DecimalFormat; class FormatDemo{ public void format1(String pattern,double value) { DecimalFormat df = null ; df = new DecimalFormat(pattern) ; String str = df.f翻译 2017-09-09 09:19:46 · 163 阅读 · 0 评论 -
日期转换类
package class1; import java.text.SimpleDateFormat; import java.util.Date; class DateTime { private SimpleDateFormat sdf = null ; public String getDate() { this.sdf = new SimpleDateFormat("yyy-MM翻译 2017-09-08 18:04:09 · 232 阅读 · 0 评论 -
日期转换
package class1; import java.text.SimpleDateFormat; import java.util.Date ; public class StringDateDemo { public static void main(String[] args) throws Exception{ String strDate = "2008-10-19 10;1翻译 2017-09-08 17:39:28 · 162 阅读 · 0 评论 -
对象一对多关系
package class1; class Person { private String name ; private int age ; private Book book ; private Person child ; public Person(String name , int age){ this.setName(name) ; this.setAge(age) ;翻译 2017-09-04 17:45:57 · 314 阅读 · 0 评论 -
比较对象
package class1; class PersonA { private String name ; private int age ; public PersonA(String name , int age) { this.setName(name) ; this.setAge(age) ; } public boolean compare(PersonA p) { P原创 2017-09-05 09:49:30 · 196 阅读 · 0 评论 -
单例设计模式
package class1; //单例设计模式 class Singleton { private static Singleton instance = new Singleton(); private Singleton(){} public void print() { System.out.println("Hello World!!!"); } public stati翻译 2017-09-05 14:17:41 · 166 阅读 · 0 评论 -
链表
package class1; class Link { class Node { private String data ; private Node next ; public Node (String data) { this.data = data ; } public void add(Node newNode) { if(this.next == null) { t翻译 2017-09-05 16:29:27 · 197 阅读 · 0 评论 -
序列化
package class1; import java.io.File; import java.io.FileOutputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; public class SerDemo01 { public static void main(String翻译 2017-09-13 15:01:16 · 235 阅读 · 0 评论 -
标准接口
package class1; interface USB { public void start() ; public void stop() ; } class Computer { public static void plugin(USB usb){ usb.start() ; System.out.println("====usb设备工作======"); usb.st翻译 2017-09-06 17:01:14 · 313 阅读 · 0 评论 -
工厂设计模式
package class1; interface Fruit { public void eat() ; } class Apple implements Fruit { public void eat() { System.out.println("**吃苹果."); } } class Orange implements Fruit { public void eat()翻译 2017-09-06 17:10:55 · 155 阅读 · 0 评论 -
代理模式
package class1; interface Network { public void browse() ; } class Real implements Network { public void browse() { System.out.println("上网济览信息"); } } class Proxy implements Network{ private翻译 2017-09-06 17:20:20 · 176 阅读 · 0 评论 -
适配器模式
package class1; interface Window { public void open() ; public void close() ; public void activated() ; public void iconified() ; public void deiconified() ; } abstract class WindowAdapter imp翻译 2017-09-06 17:51:50 · 218 阅读 · 0 评论 -
宠物店
package class1; interface Pet { public String getName() ; public String getColor() ; public int getAge() ; } class Cat implements Pet { private String name ; private String color ; private in翻译 2017-09-07 11:45:51 · 543 阅读 · 0 评论 -
内部类
package class1; interface AA{ public void printInfo() ; } class X { public void fun1() { this.fun2(new AA(){ public void printInfo() { System.out.println("Helo world!!!"); } }); } public v翻译 2017-09-08 10:13:50 · 151 阅读 · 0 评论 -
异常
package class1; class Math { public int div(int i ,int j) throws Exception { System.out.println("====计算开始====="); int temp = 0 ; try { temp = i / j ; } catch (Exception e ) { throw e ; } fina翻译 2017-09-08 10:55:58 · 155 阅读 · 0 评论 -
自定义异常
package class1; class MyException extends Exception { public MyException(String msg) { super(msg) ; } } public class DefaultException { public static void main(String args[]) { try { throw n翻译 2017-09-08 11:21:25 · 286 阅读 · 0 评论 -
泛型
package class1; interface Info1 {} class Contact implements Info1 { private String address ; private String telphone ; private String zipcode ; public Contact(String address,String telphone,Stri转载 2017-09-08 15:37:33 · 179 阅读 · 0 评论 -
日期转换
package class1; import java.text.DateFormat; import java.util.Date; public class DateDemo03 { public static void main(String[] args) { DateFormat df1 = null ; DateFormat df2 = null; df1 = DateF翻译 2017-09-08 17:24:40 · 199 阅读 · 0 评论 -
日期转换
package class1; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateDemo05 { public static void main(String[] args) { String strDate = "20翻译 2017-09-08 17:35:16 · 209 阅读 · 0 评论
分享