Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 18, 2024 02:46 am GMT

84

JavaRunnableD

public class Sample {    public static void main(String[] args) {        int cnt = 0; // cnt0        // Runnable        Runnable r = () -> {            // cnt            // cntcnt            for (cnt = 0; cnt < 10; cnt++) {                // cnt++                // cnt                // Java                //                 System.out.println(cnt++);            }        };        //         new Thread(r).start();    }}

cntJavafinalforcnt++

D.

Runnablecntcnt


public class Sample {    public static void main(String[] args) {        // finalfinal        //         Runnable r = () -> {            for (int i = 0; i < 10; i++) {                // i                System.out.println(i);            }        };        // RunnableThread        new Thread(r).start();    }}

RunnableiRunnableRunnablecnt


Original Link: https://dev.to/aaattt/8zhang-4-4fmo

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To