how to create thread in java?

Answer Posted / vamsikrishna

we can do it in two ways.
one is by extending thread class and other is by
implementing Runnable interface.
here the later one is good because when we are going for
mutiple inheritance only interface helps us

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is abstraction in oops with example?

770


What is polymorphism and why is it important?

556


What is a class in oop?

599


What is an advantage of polymorphism?

589


What are the benefits of polymorphism?

619






why reinterpret cast is considered dangerous?

1898


What is an interface in oop?

591


#include #include #include #include void insert(struct btreenode **, int); void inorder(struct btreenode *); struct btreenode { struct btreenode *leftchild; struct btreenode *rightchild; int data; }; main() { struct btreenode *bt; bt=(struct btreenode *)NULL; int req,i=1,num; clrscr(); printf("Enter number of nodes"); scanf("%d",&req); while(i<=req) { printf("Enter element"); scanf("%d",&num); insert(&bt,num); i++; } inorder(bt); } void insert(struct btreenode **sr, int num) { if(*sr==NULL) { *sr=(struct btreenode *)malloc (sizeof(struct btreenode)); (*sr)->leftchild=(struct btreenode *)NULL; (*sr)->rightchild=(struct btreenode *)NULL; (*sr)->data=num; return; } else { if(num < (*sr)->data) insert(&(*sr)->leftchild,num); else insert(&(*sr)->rightchild,num); } return; } void inorder(struct btreenode *sr) { if(sr!=(struct btreenode *)NULL) { inorder(sr->leftchild); printf("\n %d",sr->data); inorder(sr->rightchild); } else return; } please Modify the given program and add two methods for post order and pre order traversals.

3246


What do you mean by variable?

572


What is encapsulation oop?

574


What is meant by multiple inheritance?

736


If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?

942


What is inheritance in oop?

597


any one please tell me the purpose of operator overloading

1965


What are oops functions?

583