08 2013 档案

摘要:package ming;import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.InputEvent;impo... 阅读全文
posted @ 2013-08-25 14:47 MrMrCash 阅读(347) 评论(0) 推荐(0)
摘要:package ming;import java.util.ArrayList;import java.util.Collection;import java.util.Comparator;import java.util.List;import java.util.TreeSet;/* * 按照... 阅读全文
posted @ 2013-08-22 00:50 MrMrCash 阅读(294) 评论(0) 推荐(0)
摘要:package ming;import java.util.ArrayList;import java.util.Collection;import java.util.List;/* * 返回最后一个被复制的元素 * dest必须是src的父类或者本身 * 作用:集合之间的赋值 * */publi... 阅读全文
posted @ 2013-08-22 00:15 MrMrCash 阅读(299) 评论(0) 推荐(0)
摘要:package ming;import java.util.ArrayList;import java.util.Collection;import java.util.List;class MyClass{ public MyClass(T t){ System.out.println("t ... 阅读全文
posted @ 2013-08-22 00:02 MrMrCash 阅读(583) 评论(0) 推荐(0)
摘要://提供两种使用情况,第二种情况定义前者是后者的子类-类型通配方式package ming;import java.util.ArrayList;import java.util.Collection;public class GenericMethodTest { static void fro... 阅读全文
posted @ 2013-08-21 01:02 MrMrCash 阅读(391) 评论(0) 推荐(0)
摘要:package ming;import java.util.ArrayList;import java.util.Collection;import java.util.List;class Canvas { // ? extends Shape,定义了子类,所以List可以用 public voi... 阅读全文
posted @ 2013-08-21 00:43 MrMrCash 阅读(331) 评论(0) 推荐(0)
摘要:package ming;class Apple3{ private T info; public Apple3(){} public Apple3(T info){ this.info = info; } public T getInfo() { return info; } public v... 阅读全文
posted @ 2013-08-20 01:11 MrMrCash 阅读(215) 评论(0) 推荐(0)
摘要:package ming;public class Apple2 { public T info; public Apple2(T info) { this.info = info; } public T getInfo() { return info; } public void setIn... 阅读全文
posted @ 2013-08-20 00:55 MrMrCash 阅读(197) 评论(0) 推荐(0)
摘要:package ming;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import jav... 阅读全文
posted @ 2013-08-19 00:12 MrMrCash 阅读(380) 评论(0) 推荐(0)
摘要:package ming;import java.util.Hashtable;class D { int count; public D(int count) { this.count = count; } public boolean equals(Object obj) { if (obj... 阅读全文
posted @ 2013-08-18 23:26 MrMrCash 阅读(248) 评论(0) 推荐(0)
摘要:package ming;import java.util.Comparator;import java.util.TreeSet;class M { int age; public M(int age) { this.age = age; } @Override public String to... 阅读全文
posted @ 2013-08-18 22:23 MrMrCash 阅读(296) 评论(0) 推荐(0)
摘要:package ming;enum Operation { PLUS { public double eval(double x, double y) { return x + y; } }, MINS { public double eval(double x, double y) { ... 阅读全文
posted @ 2013-08-18 01:45 MrMrCash 阅读(794) 评论(0) 推荐(0)
摘要:package ming;interface GenderDoc { void info();}enum Gender implements GenderDoc { // public static final Gender MALE = new Gender("男"); MALE("男") { ... 阅读全文
posted @ 2013-08-18 01:31 MrMrCash 阅读(1729) 评论(0) 推荐(0)
摘要:package ming;enum Gender{ MALE("男"),FEMALE("女"); //public static final Gender MALE = new Gender("男"); private String name; public String getName() { ... 阅读全文
posted @ 2013-08-18 01:17 MrMrCash 阅读(327) 评论(0) 推荐(0)
摘要:package ming;interface Teachable { void work();}class Programer { private String name; public String getName() { return name; } public void setName(S... 阅读全文
posted @ 2013-08-18 00:45 MrMrCash 阅读(197) 评论(0) 推荐(0)
摘要:package ming;class Outer { class In { public In(String msg) { System.out.println(msg); } }}public class InTest extends Outer.In { public InTest(Ou... 阅读全文
posted @ 2013-08-17 20:36 MrMrCash 阅读(168) 评论(0) 推荐(0)
摘要:1. 接口只能定义抽象方法,不包含已经提供实现的方法。 抽象类可以包含普通方法2. 接口不能定义静态方法。抽象类可以定义静态方法3. 接口里只能定义静态常量filed,不能定义普通filed。 抽象类可以定义普通field,也可以定义静态filed。4. 接口里面不包含构造器,抽象类可以包含构造器,... 阅读全文
posted @ 2013-08-17 19:15 MrMrCash 阅读(162) 评论(0) 推荐(0)
摘要:package ming;public class CacheImmutale { private static int MAX_SIZE = 10; private static CacheImmutale[] cache = new CacheImmutale[MAX_SIZE]; privat... 阅读全文
posted @ 2013-08-16 01:12 MrMrCash 阅读(279) 评论(0) 推荐(0)
摘要:#include #include using namespace std;int compared(const void *key1,const void *key2){ //cout*iKey2){ //coutj) { //the left elements has no more elements to merge while(jposk) { //right division has no more elements to merge. while(ipos<=j) { memcpy(&m[mpos*esize],&a[ipos*esize],esize... 阅读全文
posted @ 2013-08-13 00:02 MrMrCash 阅读(241) 评论(0) 推荐(0)
摘要://合并有序数组//合并例子void MemeryArray(int a[], int n, int b[],int m, int c[]){ int i,j,k; i=j=k=0; while(i<n && j<m) { if(a[i]<b[j]) { c[k++] = a[i++]; } else { c[k++]=b[j++]; } } while(i<n) { c[k++]=a[i++]; } while(j<n) { c[k++] = b[j++]; }}//排序需要调用的如下//排序调用bool MergeSort(int a[], i 阅读全文
posted @ 2013-08-09 01:16 MrMrCash 阅读(257) 评论(0) 推荐(0)
摘要://比较大小static int compare_int(const void *int1,const void *int2){ if(*(const int*)int1>*(const int*)int2) { return 1; } else if(*(const int*)int1=0&&compare(&a[i*esize],key)>0){ memcpy(&a[(i+1)*esize],&a[i*esize],esize); i--; cout0); do{ // cout= k) { // cout<<"do 阅读全文
posted @ 2013-08-09 01:10 MrMrCash 阅读(319) 评论(0) 推荐(0)
摘要:void quick_sort(int s[],int l,int r){ if(l= x) { j--; } if(i<j) { s[i++]=s[j]; } while(i<j && s[i]<x) { i++; } if(i<j) { s[j--]=s[i]; } } s[i]=x; quick_sort(s,l,i-1); quick_sort(s,i+1,r); } 阅读全文
posted @ 2013-08-09 01:01 MrMrCash 阅读(241) 评论(0) 推荐(0)
摘要://用于比较大小int compared(const void *key1,const void *key2){ cout*iKey2){ //cout=0&&compare(&a[i*esize],key)>0){ memcpy(&a[(i+1)*esize],&a[i*esize],esize); i--; cout<<i<<endl; } memcpy(&a[(i+1)*esize],key,esize); } free(key); return 0; }} 阅读全文
posted @ 2013-08-09 00:59 MrMrCash 阅读(230) 评论(0) 推荐(0)
摘要:void issort2(int a[],int n){ int temp=0; int i=0,j=0; for(i=1;i=0 && a[j]>temp) { a[j+1]=a[j]; j--; } a[j+1]=temp; }} 阅读全文
posted @ 2013-08-09 00:56 MrMrCash 阅读(179) 评论(0) 推荐(0)