08 2014 档案

摘要:当使用Serializable接口实现序列化操作时,如果一个对象中的某个属性不希望被序列化, 则可以使用transient关键字进行声明: import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; imp... 阅读全文
posted @ 2014-08-21 16:39 塔斯曼 阅读(120) 评论(0) 推荐(0)
摘要:import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; public class CharSetDemo02 { public static void main(String[] args) throws Exception { File fi... 阅读全文
posted @ 2014-08-21 15:50 塔斯曼 阅读(161) 评论(0) 推荐(0)
摘要:import java.io.IOException; import java.io.OutputStream; public class SystemDemo01 { public static void main(String[] args) { OutputStream out = System.out; //向上转型后丢失子类方法? ... 阅读全文
posted @ 2014-08-19 14:01 塔斯曼 阅读(196) 评论(0) 推荐(0)
摘要:import java.io.IOException; import java.io.PipedInputStream; import java.io.PipedOutputStream; class Send implements Runnable { private PipedOutputStream pos = null; public Send() { ... 阅读全文
posted @ 2014-08-19 13:59 塔斯曼 阅读(117) 评论(0) 推荐(0)
摘要:import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; imp... 阅读全文
posted @ 2014-08-19 10:08 塔斯曼 阅读(481) 评论(0) 推荐(0)
摘要:字节流例子: import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class OutputStreamDemo05 { public static void main(Str... 阅读全文
posted @ 2014-08-19 09:29 塔斯曼 阅读(147) 评论(0) 推荐(0)
摘要:整个java.io包中最重要的就是5个类和一个接口,5个类指的是File,OutputStream,InputStream,Reader,Writer;一个接口是Serializable。 在整个io包中,唯一与文件本身有关的类就是file类。 import java.io.File; import java.io.FileInputStream; import java.io... 阅读全文
posted @ 2014-08-18 17:44 塔斯曼 阅读(128) 评论(0) 推荐(0)
摘要:import java.text.SimpleDateFormat; import java.util.Date; import java.util.Timer; import java.util.TimerTask; class MyTask extends TimerTask { public void run() { SimpleDateFor... 阅读全文
posted @ 2014-08-14 17:23 塔斯曼 阅读(186) 评论(0) 推荐(0)
摘要:不使用正则表达式: import java.util.Scanner; public class RagexDemo01 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String str = scanner.nex... 阅读全文
posted @ 2014-08-14 16:40 塔斯曼 阅读(145) 评论(0) 推荐(0)
摘要:import java.util.Observable; import java.util.Observer; class House extends Observable { private float price; public float getPrice() { return price; } public void ... 阅读全文
posted @ 2014-08-14 15:36 塔斯曼 阅读(127) 评论(0) 推荐(0)
摘要:import java.util.Comparator; class Studentxx { private String nameString; private int age; public Studentxx(String nameString, int age) { // super(); ... 阅读全文
posted @ 2014-08-14 15:08 塔斯曼 阅读(244) 评论(0) 推荐(0)
摘要:class BinaryTree { class Node { private Comparable data; private Node left; private Node right; public void addNode(Node newNode) { if (ne... 阅读全文
posted @ 2014-08-14 14:46 塔斯曼 阅读(139) 评论(0) 推荐(0)
摘要:class Studentx implements Comparable { private String name; private int age; private float score; public Studentx(String name, int age, float score) { this.name = n... 阅读全文
posted @ 2014-08-14 14:28 塔斯曼 阅读(208) 评论(0) 推荐(0)
摘要:class Person { private String name; private int age; public Person(String name, int age) { this.name = name; this.age = age; } public String toString... 阅读全文
posted @ 2014-08-13 15:04 塔斯曼 阅读(122) 评论(0) 推荐(0)
摘要:取时间差: public class SystemDemo01 { public static void main(String[] args) { long startTime = System.currentTimeMillis(); for (int i = 0; i < 1000; i++) { try... 阅读全文
posted @ 2014-08-13 15:01 塔斯曼 阅读(123) 评论(0) 推荐(0)
摘要:.properties文件放到当前目录下会报错: 需要放到src文件夹下: 阅读全文
posted @ 2014-08-12 14:34 塔斯曼 阅读(1138) 评论(0) 推荐(0)
摘要:public class RunTimeDemo02 { public static void main(String[] args) { Runtime runtime = Runtime.getRuntime(); Process process = null; try { proces... 阅读全文
posted @ 2014-08-12 12:01 塔斯曼 阅读(134) 评论(0) 推荐(0)
摘要:public class StringBufferDemo02 { public static void main(String[] args) { StringBuffer bf = new StringBuffer("I am bf,"); // bf="I am a bf,"; fun1(bf); ... 阅读全文
posted @ 2014-08-12 10:51 塔斯曼 阅读(138) 评论(0) 推荐(0)
摘要:class Info{ private T var; public T getVar(){ return var; } public void setVar(T var){ this.var=var; } public String toString(){ ... 阅读全文
posted @ 2014-08-11 10:15 塔斯曼 阅读(281) 评论(0) 推荐(0)
摘要:① ボタンのクリック事件:Sub Click(Source As Button) Dim ws As New NotesUIWorkspace Dim uidoc As NotesUIDocument Set uidoc =ws.CurrentDocument content = uidoc.Fie... 阅读全文
posted @ 2014-08-07 13:00 塔斯曼 阅读(181) 评论(0) 推荐(0)
摘要:1,computer management->storage->disk management2,new sample volumealt+44=,alt+59=; 阅读全文
posted @ 2014-08-07 12:59 塔斯曼 阅读(92) 评论(0) 推荐(0)
摘要:卖出的票为负数的情况: class MyThread22 implements Runnable { private int ticket = 10; public void run() { for (int i = 0; i 0) { try { Thread.sle... 阅读全文
posted @ 2014-08-06 17:21 塔斯曼 阅读(114) 评论(0) 推荐(0)
摘要:在线程操作中,可以使用yield()方法将一个线程的操作暂时让给其他线程执行: class MyThread17 implements Runnable { public void run() { for (int i = 0; i " + i); if (i == 3) { ... 阅读全文
posted @ 2014-08-06 14:39 塔斯曼 阅读(232) 评论(0) 推荐(0)
摘要:在程序中允许一个线程进行暂时的休眠,直接使用Thread.sleep()方法即可实现休眠: class myThread11 implements Runnable { public void run() { for (int i = 0; i < 5; i++) { try { Thread.... 阅读全文
posted @ 2014-08-06 11:18 塔斯曼 阅读(355) 评论(0) 推荐(0)
摘要:在java运行时至少会启动两个线程,一个是main线程,一个是垃圾收集线程。 在线程操作中,可以使用join()方法让一个线程强制运行,线程强制运行期间,其他线程无法运行,必须等待此线程完成之后才可以继续执行: class myThread10 implements Runnable{ public void run() { for(int i=0;i10)... 阅读全文
posted @ 2014-08-06 10:53 塔斯曼 阅读(323) 评论(0) 推荐(0)
摘要:java中启动多线程有两种方法,一是继承Thread类,二是实现Runnable接口。 继承Thread类: java中正确地启动多线程不能直接调用run()方法,而是调用从Thread类中继承而来的start()方法。 class myThead01 extends Thread { private String name; public myThead01(Stri... 阅读全文
posted @ 2014-08-05 15:31 塔斯曼 阅读(121) 评论(0) 推荐(0)
摘要:打包jar文件和设置class路径: 查看jar文件内容: 阅读全文
posted @ 2014-08-05 14:15 塔斯曼 阅读(130) 评论(0) 推荐(0)
摘要:public class RuntimeExceptionDemo01 { public static void main(String[] args) { String string="123"; int temp=Integer.parseInt(string); System.out.println("123*123=: "+temp*temp)... 阅读全文
posted @ 2014-08-05 10:28 塔斯曼 阅读(492) 评论(0) 推荐(0)
摘要:div的异常抛给main来处理: class Math{ public int div(int i,int j)throws Exception{ int temp=i/j; return temp; } } public class ThrowsDemo01 { public static void ... 阅读全文
posted @ 2014-08-05 09:46 塔斯曼 阅读(147) 评论(0) 推荐(0)
摘要:interface Window { public void open(); public void close(); public void activated(); public void iconified(); public void deiconified(); } abstract class WindowAdapter im... 阅读全文
posted @ 2014-08-04 14:25 塔斯曼 阅读(113) 评论(0) 推荐(0)
摘要:interface Fruit { void eat(); } class Apple implements Fruit { public void eat() { System.out.println("I am eating apple."); } } class Orange implements Fruit { ... 阅读全文
posted @ 2014-08-04 10:35 塔斯曼 阅读(104) 评论(0) 推荐(0)
摘要:public class NewDemo01 { public static void main(String[] args) { System.out.print("No args(fun()):"); fun(); System.out.print("\n one args(fun()):"); ... 阅读全文
posted @ 2014-08-01 15:32 塔斯曼 阅读(133) 评论(0) 推荐(0)
摘要:public class ArrayDemo05 { public static void main(String[] args) { int list01[]={67,89,87,69,90,100,75,90}; int max; int min; max=min=list01[0]; for(int i=0;imax)... 阅读全文
posted @ 2014-08-01 15:00 塔斯曼 阅读(271) 评论(0) 推荐(0)
摘要:package Counter; public class Counter { private int counter; private static Counter instance = null; protected Counter() { } public static Counter getInstance() { ... 阅读全文
posted @ 2014-08-01 11:30 塔斯曼 阅读(112) 评论(0) 推荐(0)