`
xuweilovejava
  • 浏览: 8662 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
public class Contact { private String type; private String name; private String address; private String city; private String province; private String postalcode; private String country; //增加一个country的属性: from private String countryFrom; private St ...
jdk动态代理和CGLIB动态代理的区别:    jdk动态代理只能针对实现了接口的目标代理, CGLIB是针对类来实现动态代理,当没有实现接口的类需要代理时,就需要通过CGLIB来实现动态代理。jdk动态代理:   User.java public class User { private String uname; private String email; public String getUname() { return uname; } public void setUname(String uname) { ...
import java.util.HashMap; import java.util.Map; import java.util.Random; public class ThreadLocalTest { private static Map<Thread, Integer> threadData = new HashMap<Thread, Integer>(); private static ThreadLocal<Integer> threadLocal = new ThreadLocal<Integer>(); /** * 开启 ...
要求: 1、先主线程循环100次, 2、接着子线程循环10, 3、再主线程循环100次, 4、再子线程循环10, 如此反复50次 步骤: 1、创建一个业务类: class Bussieser { private boolean flag = true; public synchronized void sub() { if(!flag){ try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } for (int i = 1; i <= 10; ...
新建xml文件(users.xml): <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <users> <user id="u1"> <address> <address>海淀</address> </address> <nickname>张三</nickname> <username>zhangsan</userna ...
新建User类 @XmlRootElement(name="User") public class User { private int id; private String username; private String nickname; private String password; private Address address; public int getId() { return id; } public String getUsername() { return username; } public String ...
建立一个学生类(Student.class): public class Student { private int id; private String username; private String password; public int getId() { return id; } public String getUsername() { return username; } public String getPassword() { return password; } public void setId(int id) { this.id ...
二分查找数组必须为有序数组,查找速度比无序数组快,插入速度比无序数组慢。 查找次数为数组长度的开方。 方法: public static int find(long searchKey) { long[] arr = new long[100]; arr[0] = 11; arr[1] = 22; arr[2] = 33; arr[3] = 44; arr[4] = 55; arr[5] = 66; arr[6] = 77; arr[7] = 88; arr[8] = 99; arr[9] = 100; int countElems = 10; ...
冒泡排序在发现比它小的时候就交换,选择排序只有在确定了最小的数据之后,才会发生交换。 插入排序速度比冒泡排序速度快一倍,比选择排序速度还快些。 冒泡排序: 第一种方式: int[] arr = new int[] { 22, 55, 44, 66, 33, 11, 77, 99 ...
Global site tag (gtag.js) - Google Analytics