- 博客(11)
- 收藏
- 关注
原创 向线程池提交任务的两种方式
方式一:提交无返回值的任务(execute);class RunnableThread implements Runnable{ @Override public void run() { for(int i=0;i<10;i++){ System.out.println (Thread.currentThread ().get...
2019-06-29 23:06:32 7462
原创 死锁实例
class Pen{ private String pen="笔"; public String getPen(){ return pen; }}class Book{ private String book ="书"; public String getBook(){ return book; }}cla...
2019-06-14 23:45:02 272
原创 全局锁
方法一:class Sync{ public void test() { synchronized(Sync.class){ System.out.println ( "test方法开始,当前线程为:" + Thread.currentThread ( ).getName ( ) ); try { Th...
2019-06-14 23:43:56 834
原创 普通锁
public class 普通锁 { public static void main(String[] args) { final Object object=new Object (); new Thread ( new Runnable ( ) { @Override public void run() { synchronized (...
2019-06-14 23:40:14 120
原创 synchronized在方法上的同步
class Mythread4 implements Runnable{ private int ticket=10; @Override public void run() { for(int i=0;i<10;i++){ this.sale (); } } public synchronized void sa...
2019-06-14 23:39:02 352
原创 synchronized在代码块上的同步
class Mythread implements Runnable { private int ticket = 20; @Override public void run() { for (int i = 0; i < 100; i++) { synchronized (this) { i...
2019-06-14 23:37:55 263
原创 生产者与消费者模型
一、商品类import javax.swing.*;import java.util.LinkedList;import java.util.Queue;public class Goods { private String id; private String name; private double price; public Goods(Stri...
2019-06-12 23:57:10 121
原创 用table进行网页的布局
<!DOCTYPE html><html><head> <meta charset="utf-8" /> <title>table首页布局</title> </head> <body> <table width="100%"> <tr> <...
2019-06-12 23:46:38 4155
原创 MapReduce模型(对数据的统计分析)
1.编写一个简单的数据统计操作package 集合框架库.Map集合.MapReduce;public class Order { private String title; private double price; private int amonu; public Order(String title, double price, int amo...
2019-06-08 00:16:42 732
原创 Linux虚拟机具体安装过程及安装包链接
一、首先准备安装包链接如下:链接:https://pan.baidu.com/s/1k8W4nvDaffGQUVAGfgYy7g提取码:3fhu二、首先安装VMWare(具体如下)1.选中该安装包打开一直点下一步直到出现一下界面2.进行破解选中红色区域打开,然后将密钥复制粘贴进去然后完成即可三、打开VMWare以管理员身份打开该文件打开后可看到以下...
2019-06-06 01:15:51 2042 1
原创 TreeSet排序分析
import java.util.Set;import java.util.TreeSet;class Person implements Comparable<Person> { private int age; private String name; public int getAge() { return age; }...
2019-06-02 23:38:11 111
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人