上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 22 下一页
摘要: 能用就用,不能用就不用 范例表示颜色多例模式: package cn; class Color { private String title ; private static final Color RED = new Color("red") ; private static final Colo 阅读全文
posted @ 2016-01-30 10:14 式微胡不归 阅读(169) 评论(0) 推荐(0) 编辑
摘要: package cn; class Message <T> { private T msg ; public T getMsg() { return msg; } public void setMsg(T msg) { this.msg = msg; } } public class Test { 阅读全文
posted @ 2016-01-30 08:46 式微胡不归 阅读(277) 评论(0) 推荐(0) 编辑
摘要: package cn; class Point <T>{ //Type = T , 是一个类型 private T x ; private T y ; public void setX(T x){ this.x = x ; } public T getX() { return x; } public 阅读全文
posted @ 2016-01-30 08:10 式微胡不归 阅读(150) 评论(0) 推荐(0) 编辑
摘要: JDK1.5之后 如果是static方法则可以直接调用方法: 范例: class Mytest { public static int add(int x , int y) { return x + y ; } public static int div(int x, int y){ return 阅读全文
posted @ 2016-01-29 22:06 式微胡不归 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 从JDK1.5之后增加的foreach循环取消索引 for(类型 变量 : 数组 | 集合){ 每一次循环会自动将数组内容设置给变量 } 范例: int [] i = {1,2,3,4} ; for(int x : i){ System.out.println(x) ; } ArrayList <S 阅读全文
posted @ 2016-01-29 21:57 式微胡不归 阅读(130) 评论(0) 推荐(0) 编辑
摘要: ---恢复内容开始--- OutputStream 类是一个专门进行字节数据输出的一个类。 由文档可以看到 OutputStream 实现了三个接口。 Closeable 接口: 在 JDK1.7的时候使得Closeable继承了AutoCloseable接口 Closeable接口的方法: Flu 阅读全文
posted @ 2016-01-27 19:17 式微胡不归 阅读(860) 评论(0) 推荐(0) 编辑
摘要: 1.Thread 方法的子类package cc;class myThread extends Thread { private String title ; public myThread(String title){ this.title = title ; } ... 阅读全文
posted @ 2016-01-24 09:38 式微胡不归 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 1. 概述 Java 中的Set和正好和数学上直观的集(set)的概念是相同的。Set最大的特性就是不允许在其中存放的元素是重复的。根据这个特点,我们就可以使用Set 这个接口来实现前面提到的关于商品种类的存储需求。Set 可以被用来过滤在其他集合中存放的元素,从而得到一个没有包含重复新的集合。2... 阅读全文
posted @ 2016-01-23 13:49 式微胡不归 阅读(2741) 评论(0) 推荐(0) 编辑
摘要: import java.awt.AWTException;import java.awt.MenuItem;import java.awt.PopupMenu;import java.awt.SystemTray;import java.awt.TrayIcon;import java.awt.ev... 阅读全文
posted @ 2016-01-23 09:55 式微胡不归 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 监听按钮import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.* ;import javax.swing.* ;class myTest ... 阅读全文
posted @ 2016-01-19 21:27 式微胡不归 阅读(138) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 22 下一页