Math.random Fn

PHOTO EMBED

Wed May 29 2024 19:40:23 GMT+0000 (Coordinated Universal Time)

Saved by @exam123

public interface MyNum{
  public abstract double getNum();
}
public class LambdaDemo{
  public static void main(String[] args){
    MyNum.num=()->123.456;
    S.o.p("This is the value:"+num.getNum());
    num->Math.random()*100;
    S.o.p("This is random value:"+num.getNum());
    S.o.p("This is one more random value:"+num.getNum());
  }
}
OUTPUT:
123.456
420
640
content_copyCOPY