- 浏览: 82781 次
- 性别:
- 来自: 武汉
最新评论
-
yuanliangding:
有没有办法改呢。
使用反射修改final属性 -
风雪木易:
a并没有改变,用a.getter访问,别用field.get( ...
使用反射修改final属性 -
lylegend13:
哈包祥明 写道可以问一下 这篇文章要说明什么》》???
AC ...
1012 -
哈包祥明:
可以问一下 这篇文章要说明什么》》???
1012 -
gengu:
你写代码注释都不带的??
KMP
文章列表
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;
public class Main {
public static void main(String[] args) {
new Main();
}
public Main() {
Scanner s = new Scanner(Syste ...
public class test {
public static void main(String[] args) {
new test().exec("1","2","3");
}
public void exec(String...xxx){
System.out.println(xxx.length);
}
}
String...xxx的4种写法
1. String...xxx
2. String ...xxx
3. String... xxx(使用Eclipse规范代码后 ...
public class test{
public static void main(String[] args) {
switch (A.valueOf(A.class, "a1")) {
case a1:
break;
case a2:
break;
case a3:
break;
}
}
}
enum A {
a1, a2, a3;
}
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller; ...
两种方式:
1.
transfer = LocalSelectionTransfer.getTransfer();
DragSource ds = new DragSource(table, DND.DROP_MOVE);
ds.setTransfer(new Transfer[] { transfer });
ds.addDragListener(new DragSourceAdapter() {
public void dragSetData(DragSourceEvent event) {
transfer.setSelection(tableViewer.ge ...
1。
FutureTask ft=new FutureTask(new Callable<Object>(){
@Override public Object call() throws Exception{// TODO Auto-generated method stub
return null;}
});
ft.run();
System.out.println(ft.get().toString());
2。
ExecutorService es=Executors.newCachedThread ...
每行一个User,在team中选择一个。
本来想每行一个Group,每个Cell中一个RadioButton,可以实现,但是所有radio属于一个group,不能满足我的一行一个group,所以最终结果是,多个RadioButton集中在一个Cell里。
截图见我的百度空间http://hi.baidu.com/lylegend13/blog/item/d17c3b34fa797b2f5ab5f529.html?timeStamp=1299054794488
viewer = new TableViewer(container, SWT.FULL_SELE ...
在ApplicationWorkbenchWindowAdvisor.java中的postWindowOpen()函数内加入以下代码
DropTarget target = new DropTarget(getWindowConfigurer().getWindow()
.getShell(), DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY
| DND.DROP_LINK);
target.setTransfer(new Transfer[] { FileTransfer.getInstance() }); ...
public class test {
public static void main(String[] args) {
test test=new test();
A A1=new A();
A A2=new B();
// B A3=(B)new A();//代码无误,运行error
B A4=new B();
test.exec(A1);
test.exec(A2);
// test.exec(A3);
test.exec(A4);
}
public void exec(A x){
System.out.pr ...
test1是被观察者,
test2是观察者,监听test1中的变化
package test;
import java.util.Date;
import java.util.Observable;
public class test1 extends Observable {
int i = 0;
public static void main(String[] args) {
test1 t1=new test1();
test2 t2=new test2();
t1.addObserver(t2);
t2.exec(); ...
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package array;
/**
*
* @author liuyuan
*/
public class KMP_practice {
int m, n, f[];
String str, pat;
public KMP_practice(String str, String pat) {
this.str = ...
//A1.java
public class A1 {
public static void main(String[] args) {
SimpleLinkList list=new SimpleLinkList();
list.Insert(1, "a");
list.print();
list.Insert(1, "b");
list.print();
System.out.println(list.GetElem(2));
System.out.println(list.GetElemPtr( ...
- 2009-11-27 23:56
- 浏览 1020
- 评论(0)
//A1.java
import java.util.Stack;
public class A1 {
public static void main(String[] args) {
TreeNode root = new TreeNode(1, new TreeNode(2, new TreeNode(3), new TreeNode(4)), new TreeNode(5));
Tree t = new Tree(root);
exec(t);
}
// 前序遍历
public static void exec(Tree tree) ...
//A1.java
public class A1 {
private final static int N = 5;
public static void main(String[] args) {
exec();
}
// 执行
public static void exec() {
int a[][] = new int[N][N];
for (int i = 0; i < N; i++) {
reset(a);
a[0][i] = 1;
int b = 1;
for (int j = 1; ...
//A1.java
public class A1 {
private final static int N = 10;
public static void main(String[] args) {
int a[] = new int[N];
create(a);
print(a);
QuickSort(a, 0, N - 1);
print(a);
}
// 快速排序主函数
public static void QuickSort(int a[], int low, int high) {
if (low < ...