- 1
Fill in the blanks to implement the Runnable interface and run a new thread.
class A _______ , ______ { public void run() { System.out.println("Bye"); } } public class App { public static void main(String[ ] args) { Thread ob = new Thread(new _____ ()); ob. ______(); } } ----------- 1. A 2. start 3. Runnable 4. App 5.implements 6.Thread
12 odpowiedzi
+ 6
class A implements Runnable {
public void run() {
System.out.println("Bye");
}
}
public class App {
public static void main(String[ ] args) {
Thread ob = new Thread(new A ());
ob. start();
}
}
+ 5
implements
Runnable
A
start
+ 1
class A implements
Runnable
{
public void run() {
System.out.println("Bye");
}
}
public class App {
public static void main(String[ ] args) {
Thread ob = new Thread(new A
());
ob. start
();
}
}
+ 1
interface a{
}
interface b{
}
class Test:a_b{
};
+ 1
class A implements Runnable {
public void run() {
System.out.println("Bye");
}
}
public class App {
public static void main(String[ ] args) {
Thread ob = new Thread(new A ());
ob.start ();
}
}
+ 1
Drag and drop from the options below to implement the Runnable interface and run a new thread.
Answer :-
class A implements Runnable {
public void run() {
System.out.println("Bye");
}
}
public class App {
public static void main(String[ ] args) {
Thread ob = new Thread(new A());
ob.start();
}
}
+ 1
interface a{
}
interface b{
}
class Test:a,b{
};
0
Thank you so much ~
0
you're welcome
0
class A
extends
Thread {
public void
run
() {
System.out.println("Hello");
}
public static void main(String[ ] args) {
A object = new A();
object.
start
();
}
}
This is correct
0
class Program
{
static void Main(string[] args)
{
Draw pencil = new Draw();
Draw brush = new Brush();
Draw spray = new Spray();
pencil.StartDraw();
brush.StartDraw();
spray.StartDraw();
}
}
/*
Draw => "Using pencil"
Brush => "Using brush"
Spray => "Using spray"
*/
public interface IDraw
{
void StartDraw();
}
class Draw : IDraw
{
public virtual void StartDraw()
{
Console.WriteLine("Using pencil");
}
}
//inherit this class from the class Draw
class Brush : Draw
{
public override void StartDraw()
{
Console.WriteLine("Using brush");
}
//implement the StartDraw() method
}
//inherit this class from the class Draw
class Spray : Draw
{
public override void StartDraw()
{
Console.WriteLine("Using spray");
}
//implement the StartDraw() method
}
0
implements
Runnable
A
start