About thread | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About thread

Is that "start" method from the "thread" class? Can anyone please answer.

8th Nov 2019, 5:30 PM
Bibekananda Besra
Bibekananda Besra - avatar
2 Answers
+ 2
Yes the start() is from Thread class which implements Runnable interface. Here is a small piece of code for you to understand it better. import java.util.*; public class Program { public static void main(String[] args) { A obj = new A(); obj.start(); } } class A extends Thread{ public void run(){ for(int i=1;i<=5;i++){ System.out.println(i); } } }
8th Nov 2019, 5:50 PM
Avinesh
Avinesh - avatar
0
got it bro ... Thankkss s
8th Nov 2019, 6:21 PM
Bibekananda Besra
Bibekananda Besra - avatar