`
文章列表
链接:http://www.iteye.com/topic/1134016 题1:二维数组(N*N),沿对角线方向,从右上角打印到左下角如N=4:  4*4数组 写道 { 1 2 3 4 } { 5 6 7 8 } { 9 10 11 12 } {13 14 15 16 }   要求打印出 写道 4 3 8 2 7 12 1 6 11 16 5 10 15 9 14 13   03 02 13 01 12 23 00 11 22 33 10 21 32 20 31 30  程序: public class Tst { public stati ...
Java与模式 资料 光盘 源文件
http://hi.baidu.com/tengxiaofei001/item/a995a9269023c60b77272c00 写道 1. 在构造函数一开始,this就是可用的了。 2. 构造函数和普通函数一样,并不是默认被synchronized 的,有可能出现同步问题。 3. 如果构造函数中访问静态变量的话,必须同步这个静态变量,否则一定会出问题。 4. 如果只访问成员变量的话,无论在任何线程中,每一次构造函数被调用,其中的成员变量都是新建造出来的,因此不可能出现说在这个线程中运行的构造函数 会访问到另一个线程中运行的构造函数中的成员变量的情况,因此这就是我所说的“访问成员变量不可能出 ...
GOF Design Patterns Source Code

类语句块

    博客分类:
  • Java
 
public class Snippet extends supperone{ public static void main(String[] args) { new Thread() { { setDaemon(true); } public void run() { System.out.println("acquired"); } }.start(); } }   写道 { setDaemon(true); }   就是类语句块; 对象的初始化过程:先初始化父类的静态成员,再初始化子类的静态 ...
public class Snippet { public static void main(String[] args) { System.out.println("buzzards".hashCode()); System.out.println("righto".hashCode()); System.out.println("buzzards".hashCode() == "righto".hashCode()); } }/* Output ...

tcl regexp

regexp   regexp  {(?:.*)(?:xx/)(.*?)(/)(.*)} $b all var =============== tst ===============set a {<xxxxx/fadxx/abc/yyyyyyyyyyyyyyy }if [regexp  {(?:.*)(?:ip/)(.*?)(/)(.*)} $b all var] {puts $var} # abc   1,(?:xx/) ?: 确定不要匹配的字符。如(?:xx/) 不要匹配。 2,((.*?))  ? 表示不贪婪
keyword: Thinking in Patterns.pdf  

基本的小程序

    博客分类:
  • Java
斐波那契数列。(Fibonacci) public class Fibonacci { public static int fib(int n) { if(n < 2) return 1; return fib(n-2) + fib(n-1); } public static void main(String[] args) { for(int i = 0; i<18; i++) { System.out.print(fib(i) + ", "); } } } /* output: 1, 1, 2, ...
关键字:Eclipse插件开发例子  
关键字:Thinking in Java source code and practice、Java编程思想源代码(第4版)和习题答案  
面试题:新建一个类,这个类要作用hashmap的键值,问需要覆盖那些类?怎么覆盖? 需要覆盖hashCode和equals。   如果覆盖:eclipse有自带的方法。 public class HashObject { private int id; private String name; private Object o; @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + id; result ...
向SourceView增加垂直行号标注       // 设置垂直行号标注 CompositeRuler ruler = new CompositeRuler(); LineNumberRulerColumn lineCol = new LineNumberRulerColumn(); lineCol.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY)); ruler.addDecorator(0, lineCol); sourceViewer = ne ...
编程题:输入两个参数,N和M,用M个数字加起来等于N.   我理解成了从M个数中,找出和为N的组合。   public class SubSet { public static void main(String[] args) { int[] m = { 1, 2, 3, 4 }; int n = 3; // getBinarySubSet(5); getGroupSumEqualN(m, n); } public static void getGroupSumEqualN( ...
private void updatePerspectiveBarText() { IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); PerspectiveBarManager barManager = ((WorkbenchWindow)activeWorkbenchWindow).getPerspectiveBar(); if(barManager != null) { barMa ...
Global site tag (gtag.js) - Google Analytics