Lambda

函数式接口:存在这样一个接口,仅含有一个方法。
有参:

public class Lambda {
    public static void main(String[] args) {
        ILike i1=(int a,double b)->{
            System.out.println("++++++"+a);
            System.out.println("------"+b);
        };
        i1.Lambda(10,10.0);
    }
//函数式接口,仅含有一个方法。
interface ILike{
    void Lambda(int a,double b);

无参:

public class Test_interface {
    public static void main(String[] args) {
        Play pl=()->{
            System.out.println("玩个球");
        };
        pl.Playball();
    }
//函数式接口
interface Play{
    void Playball();
}
}

线程的状态:
在这里插入图片描述
new的时候是新生,start是就绪,然后运行,运行后有可能阻塞,也有可能死亡。

进程方法:在这里插入图片描述
线程功能:join 可以令线程插队,但不建议使用,会导致阻塞。线程的观测状态,可利用thread.Getstate获取状态值。 分为开始阶段的new,运行阶段的Runnable,阻塞阶段的Waiting,结束阶段Terminared。 结束后不可再start。线程优先级,可用getPriority , setPriority(int x)分别来得到以及设置当前线程的优先级,最高10,默认5,等级高可优先运行,但该优先并不绝对。

线程分用户线程与守护线程:平时代码中用的都是用户线程,守护线程是用户线程开始就开始,结束就随之结束的一个线程。是为用户线程服务的一个作用。设置Daemon为true,默认是false
在这里插入图片描述

需要用代理的方式,setDeamon。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值