+ 3

What is the answer?

How many lines of output will this code produce? class B implements Runnable { public void run() { System.out.println("B"); } } class A extends Thread { public void run() { System.out.println("A"); Thread t = new Thread(new B()); t.start(); } public static void main(String[ ] args) { A object = new A(); object.start(); } }

28th Feb 2019, 3:15 PM
FirstSoloKiller
FirstSoloKiller - avatar
18 Respostas
+ 8
A B
11th Mar 2019, 8:26 PM
GreyWolf
GreyWolf - avatar
+ 3
Instances an object type A and you execute it to that object, and in turn A execute B. The output is: 1. A 2. B
28th Feb 2019, 9:18 PM
lTheCrow
lTheCrow - avatar
+ 3
2
6th May 2020, 9:04 AM
SANTOSH KUMAR PANI
SANTOSH KUMAR PANI - avatar
+ 2
Two lines first A then B
28th Feb 2019, 3:22 PM
JavaBobbo
JavaBobbo - avatar
+ 1
Result : A B
1st Mar 2019, 4:59 AM
sree harsha
sree harsha - avatar
+ 1
2 (A and B )
1st May 2020, 11:32 PM
JM Y
JM Y - avatar
+ 1
How many lines of output will this code produce? class B implements Runnable { public void run() { System.out.println("B"); } } class A extends Thread { public void run() { System.out.println("A"); Thread t = new Thread(new B()); t.start(); } public static void main(String[ ] args) { A object = new A(); object.start(); } } //output:- A B Answer :- 2
2nd Jul 2020, 6:24 AM
Gourav Tomar
Gourav Tomar - avatar
+ 1
2
8th Aug 2021, 12:46 PM
W.G.A.C.Nandasena
W.G.A.C.Nandasena - avatar
0
A B
7th May 2020, 8:06 AM
sree harsha
sree harsha - avatar
0
Answer : 2
21st May 2020, 12:00 AM
Reza Febriansyah
Reza Febriansyah - avatar
0
2
16th Oct 2020, 3:11 AM
Chorintians Lucky Panjaitan
Chorintians Lucky Panjaitan - avatar
0
The answer is NOT! A and B!!! The answer is : 2
11th Mar 2021, 9:21 PM
Rusz TamĂĄs
Rusz TamĂĄs - avatar
0
Answer: 2
23rd Mar 2021, 5:24 PM
Tejashree Suryawanshi
Tejashree Suryawanshi - avatar
0
2
1st Jan 2022, 12:35 PM
M.I.M.Aqueel
M.I.M.Aqueel - avatar
0
2
7th Apr 2022, 3:31 PM
Suman Saurav Das
Suman Saurav Das - avatar
0
2
8th Dec 2022, 12:05 PM
Prince Kumar
Prince Kumar - avatar