Home Tutorialhelp Comment Why Ruunable interface is better than extends a th

 
 

Comment

Deepika
Why Ruunable interface is better than extends a th,
January 2, 2007 at 3:45 PM

Why Ruunable interface is better than extends a thread?

Answer:
------------

If u r implementing Thread by Extending Thread class, u can't extend any other class/interface.

But u can achieve this by implementing Runnable interface.
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Java Interview Questions

Interface in JAVA - Java Interview Questions
Interface in JAVA  How interface fulfills all th facilities which.... To sort out this flaw java has provided Interface which supports the Multiple... on the Interface. http://www.roseindia.net/java/java-exception/create-interface.shtml 

Java Interview Questions

Difference between extends thread class vs implements runnable interface - Java Interview Questions
runnable interface, you can gain better object-oriented design and consistency...Difference between extends thread class vs implements runnable interface ... and implementing runnable interface.  Hi Friend, Difference: 1)If you 

Java Interview Questions

java bits 5 - Java Interview Questions
java bits 5  Given: 10. interface Foo {} 11. class Alpha implements Foo { } 12. class Beta extends Alpha {} 13. class Delta extends Beta { 14. public static void main( String[] args) { 15. Beta x = new Beta(); 16 

General

Java Interview Questions - Page 5
Java Interview Questions - Page 5   ...; Runnable interface. Put jobs in a run() method and call start() method to start the thread. Question: Can Java object be locked down for exclusive 

Java Beginners

Interface
for Interface in java? and want to know why they used interface instead of multiple inheritance? Thanks in advance   An interface is one which has abstract... method it will take.It creates complexity.Therefore java uses Interface 

Java Interview Questions

java - Java Interview Questions
) Interface is more flexible than abstract class because one class can only "extends...java  difference between abstract and interface?Why abstract class needed?  Hi Friend, Difference between Abstract class and Interface 

Java Interview Questions

INTERFACE - Java Interview Questions
INTERFACE  Why Use Interface in Java?i want region ?plz post answer   Hi Friend, Interfaces form a contract between the class... the methods of the interface are implemented with the correct signature.Interfaces 

Java Interview Questions

Interface - Java Interview Questions
Interface  Respected sir why we use Interface in java? because we... the interface's example. But in java programming language interface is nothing... a new interface, you are defining a new reference data type. You can use 

Java Interview Questions

JAVA INTERFACE - Java Interview Questions
JAVA INTERFACE  Can Any Interface will have inner classes or not... if YES explain me with a example.. if NO explain me why? And next one Whether an interface be final????  Hi friend, Yes, as for example 

Java Interview Questions

interface variables - Java Interview Questions
interface variables  why interface variables are final? explain me with good program example?? i knw why the variable is static but,i dont knw why... modifier ensures the value assigned to the interface variable is a true constant 

Java-Tutorials

Set Interface
Set Interface       The Set interface extends the Collection interface...: The SortedSet interface extends the Set interface. It maintains its elements 

Java Interview Questions

multi threading - Java Interview Questions
Inherictance. By implementing Runnable interface we can acheive better OOPs design and can avail more than one interface for a sigle class. Therefore implementing Runnable interface is better than extending Thread class. For further more 

Java Interview Questions

why the occupancy rate is zero? - Java Interview Questions
why the occupancy rate is zero?  import java.util.Scanner; public...("The number of floors cannot less than 1, please re-enter: "); floor=keyboard.nextInt...) { System.out.println("Number of rooms cannot less than 10, please re-enter: "); rooms 

Programming Tutorials

Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
Core Java Interview Questions Page3   ... of a relational database, but it can take other forms also.   Q 5. Why... requires declaration of Java interface types for the driver, connection 

JSP Interview Questions

java - JSP-Interview Questions
java  hi.. snd some JSP interview Q&A and i wnt the JNI(Java Native Interface) concepts matrial thanks krishna  Hi friend, Read more information. http://www.roseindia.net/interviewquestions/jsp-interview 

General

The extends keyword
in java. The extends is a keyword in java which is used in inheritance. It is used... at the following example which illustrate the use of extends keyword in java. class A { public int a=5;; } class B extends A { public 

Interview Questions

Difficult Interview Questions Page -5
Difficult Interview Questions Page -5   ... interview questions designed to discover how you handle these sorts of ... of  my designation. I think you know better than me what should I get 

Java Interview Questions

java - Java Interview Questions
/interviewquestions/ Here you will get lot of interview questions...java  hello sir this is suraj .i wanna ask u regarding interview questins in java .wat normally v see in interviews (tech apptitude)is one line 

Java Interview Questions

why zero? - Java Interview Questions
why zero?  import java.util.Scanner; public class Simple { public... number is" + lowest); } } why the lowest number is zero?.. i know by default it will be zero.. but why i can get value for largest number 

Java Interview Questions

java - Java Interview Questions
and Iterator in Java programming language.  Difference between Enumeration... and are more flexible than any other collection as arraylists are dynamic in nature... methods. While a class that extends an abstract class need not implement any 

Java Interview Questions

Threads - Java Interview Questions
feature whereas If you implement runnable interface, you can gain better object...Threads  creating a thread is two ways?extends with thread class and implements runnabule interface. What is the diffrence between those two?which 

Servlet Interview Questions

java - Servlet Interview Questions
java  servlet interview questions  Hi friend, For Servlet interview Questions visit to : http://www.roseindia.net/interviewquestions/servlet/ Thanks 

General

Collection of Large Number of Java Interview Questions!
Interview Questions - Large Number of Java Interview Questions Here you.... The Core Java Interview Questions More interview questions on core Java.. Read 

Java Beginners

about implements and extends - Java Beginners
about implements and extends  hello, class A extends B implements c // this is valid statement class A implements c extends B // this is invalid statement can u plz explain me why the 2nd statement is invalid even though 

Java Magazine Questions

interface
interface  why do we need interface in java..if it`s usefull... achieve multiple inhertitance by extends one class with another (by multilevel)...the y we need interface...THis is question often i heard from my developer 

Programming Tutorials

Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
Core Java Interview Questions Page2   ... than an interface ? Ans :  A Java interface is an abstract data type like... we cannot create objects of an interface. Typically, an interface in java 

Java Interview Questions

Marker Interface - Java Interview Questions
.  Hi friend, Marker interface : In java language programming... more information on Marker interface visit to : http://www.roseindia.net/java...Marker Interface   Hi Deepak, Marker interface means 

Java Interview Questions

marker interface - Java Interview Questions
marker interface  how to create our owen marker interface ? can u give me one example  Hi Friend, Try the following code: interface... link: http://www.roseindia.net/java/master-java/interface.shtml Thanks 

Java Interview Questions

interface
; Through interface, we can achieve the multiple inheritance. Java does not support multiple inheritance directly. Actually, when we extends more than one...interface  What is the exact use of interface in real time scenario 

Programming Tutorials

Corejava Interview,Corejava questions,Corejava Interview Questions,Corejava
Core Java Interview Questions Page1   ...;   Q 5 : What if two interface methods clash in implementation ? ... class ?  Ans: Java does not allow an interface to extend an abstract class 

Java Interview Questions

ABSTRACTION AND INTERFACE - Java Interview Questions
ABSTRACTION AND INTERFACE  When Use Abstract?When Use Interface ?I... the following links: http://www.roseindia.net/help/java/a/abstract-keyword.shtml http://www.roseindia.net/java/master-java/interface.shtml Thanks 

Java Interview Questions

Marker Interface - Java Interview Questions
Marker Interface   Hi Friends, Marker interface means a method which has no methods. so what is d use of tat. I read "It is used to check that whether the instance belongs to that class". then wat is d use 

General

Core Java Interview Questions!
Core Java Interview Questions   ...(); }   Question: How to define an Interface? Answer: In Java Interface... Method overriding through the Java interface    Question 

Java Interview Questions

java questions - Java Interview Questions
java questions  HI ALL , how are all of u?? Plz send me the paths of java core questions and answers pdfs or interview questions pdfs or ebooks :) please favor me best books of interviews questions for craking 

Java Interview Questions

core java - Java Interview Questions
languages .In java it states using of one single interface with a set of actions...core java - Use of polymorphism in object oriented programming   Hi... in creating a java program we create method void Amount( ){ ----- -----}Amount (int 

Java Interview Questions

hint - Java Interview Questions
hint  Dear roseindia, i want the java interview question... the following link: http://roseindia.net/interviewquestions/ Here you will get lot of interview questions and their answers. Thanks  thanks for your 

General

Introduction to List and Queue Interface
: The List interface extends the Collection interface to define... extends the Collection interface to define an ordered collection for holding... Introduction to List and Queue Interface 

Java Interview Questions

java - Java Interview Questions
java  i want to java&j2ee interview questions. Regards Akhilesh Kumar  Hi friend, I am sending you a link. This link will help you. Read for more information. http://www.roseindia.net/interviewquestions 

Interview Questions

Common Interview Questions Page - 5
Common Interview Questions Page - 5       Question: 21. Why should we hire you? Answer...; Question: 25. Why do you think you would do well at this job? Answer: Provide 

Java Interview Questions

Java - Java Interview Questions
Java and Collection Interfaces  I wanted to know more about Java and Collection Interfaces  Java and Collection InterfacesInterface : Types of Interfaces Interface ,simply say something to a media by using another 

Java Interview Questions

OOPs - Java Interview Questions
OOPs  i know what is an abstract class and what is an interface but i wanted to know in which scenarios i use them and why nowadays java is stressing on interface programming.and i also want to know where do we exactly implement 

Java Interview Questions

interview question - Java Interview Questions
interview question  hello i want technical interview question in current year   Hi Friend, Please visit the following links: http://www.roseindia.net/interviewquestions/ http://www.roseindia.net 

Java Interview Questions

java - Java Interview Questions
that implements the ServletConfig interface. Also, Java doesn't allow interfaces... requests. Why not use a constructor instead? Well, in JDK 1.0 constructors for dynamically loaded Java classes (such as servlets) couldn't accept arguments. So 

Java Interview Questions

interview questin of java - Java Interview Questions
interview questin of java  what r the common question of core & addvance java in interview?  Hi Garima, I am sending you a link...://www.roseindia.net/interviewquestions/corejava.shtml http://www.roseindia.net 

Programming Tutorials

JSF Interview Questions
JSF Interview Questions      ... it a better choice for Java web application development. Some... for tool vendors, for example Sun Java Studio Creator application development 

EJB Questions

interview questions - EJB
interview questions in Java  Need interview questions in Java ...://www.roseindia.net/ejb/Interview Questions: http://www.roseindia.net.... If you really want to win the interview then follow the steps.Learn core java http 

Java Interview Questions

Inner class - Java Interview Questions
Inner class  whether inner class can implement any interface(Runnable... the problem : class InnerClass1 { private int countDown = 5; private Inner inner; private class Inner extends Thread { Inner(String name 

Java Interview Questions

Java - Java Interview Questions
Interview interview, Tech are c++, java,  Hi friend, Now get more information. you can lean all type interview question by following link link.http://www.roseindia.net/interviewquestions 

Java Interview Questions

guess number - Java Interview Questions
guess number  i am doing a java program for user to guess number. i...); for(int i=0; i<5;i++) { while(num<0 || num>100... javax.swing.*; import java.util.Random; public class guess2 extends JFrame 

Java Interview Questions

java - Java Interview Questions
implementation. All the methods in any interface are abstract by default. Abstract... to the requirements. public class OverrideExample extends AbstractExam...."); } } -------------------------------- Read for more information. http://www.roseindia.net/java/master 

Java Interview Questions

Java - Java Interview Questions
.  The Java Native Interface, JNI, is just that; an interface...Java  How to use C++ code in Java Program?   Hi friend, Java does not have a preprocessor. It provides similar functionality (#define 

Java Interview Questions

java - Java Interview Questions
java  what is advantage of observer ,observable class?why we using these two type?  Hi maheswari Java Provides builtin classes... class ObserverTest extends JFrame{ private DefaultBoundedRangeModel 

Java Interview Questions

java - Java Interview Questions
while searching on google but if you want you can learn it in a interview preparation manner as well.. I have a java interview question URL from where you.../interviewquestions/corejava.shtml I think this is enough.. but u can see http 

Java Interview Questions

Multithreading ? - Java Interview Questions
Multithreading ?   Hi Friends, I am new to java... implement Synchronization keyword or singlethreadmodel interface to avoid deadlock, though why we go for multithreading.Any advantage in tat. Thank u in advance.  

Servlet Interview Questions

interview question - Servlet Interview Questions
interview question  What is Servlet? Need interview questions on Java Servlet  Servlet is one of the Java technologies which is used... according to your experience.And for collection of Java Servlet Interview Question you 

Java Interview Questions

STRINGS - Java Interview Questions
STRINGS  1.Why string objects are immutable? 2.why java is pass by value?  Hi Friend, 1) To save memory, java can refer two string... the string object that refers to more than one reference, it can mess up your 

Java Interview Questions

Interfaces - Java Interview Questions
is, see below interface i1 { void method1(); } interface i2 { void... parameters to the methods like this: interface in1 { void method(); } interface in2 { void method(int i); } public class InterfaceImplementation 

Programming Tutorials

Marker Interface,Java Marker Interface
Interface in Java       In this section we will learn about Interface and Marker Interfaces in Java. This tutorial will clarify you questions "What is marker Interface?" 

Java Interview Questions

Java Interview - Java Interview Questions
Java Interview  Please provide some probable Java interviewe Question. Thanking you. Pabitra kr debanth.  Hi friend, I am sending.... http://www.roseindia.net/interviewquestions/ Thanks 

Java Beginners

Abstract and Interface
abstract class should be extended using keyword 'extends'. 5)An interface can... for using interface? Why we use interface instead of abstract? What... Interface and Abstract Class 1)Main difference is methods of a Java interface 

General

The extends Keyword
The extends Keyword       The extends is a Java keyword, which is used in inheritance process of Java...; interface MyInterface extends SuperInterface {   

Java Interview Questions

HTMLParserTxt - Java Interview Questions
interface of DocumentFragment, so no typecast needed: processNode(doc... != 2) { System.out.println("Usage: java HTMLTextParser... javax.swing.text.html.parser.*; public class ConvertHtmlToText extends 

Java Interview Questions

java bean - Java Interview Questions
java bean  what is the diffrence between javabean and propertyfile both can be used as storage if these are there than in which case we use file and database please clearify.one more question why there is ejb if all that work can 

Java Interview Questions

java - Java Interview Questions
Why Java  Why Java? why not C or C 

Interview Questions

Common Interview Questions
Common Interview Questions     ... research on the company, it will better to prepare answer to some common interview... Interview Questions - Page 2 What's Your Biggest Weakness? Ans - This is one 

Java-Tutorials

Java Interface
extends the other interface. 3. How a class can implement one or more than one interfaces. Interface in Java is created for referencing something to other... Java Interface In this section we will discuss about the interface in Java 

Servlet Interview Questions

java - Servlet Interview Questions
Java Design Patterns Interview Questions and Answers  I need to know Java Design Patterns with the help of Interview Questions and Answers  ... implemented Servlet and ServletConfig interface for developing GenericServlet.And also 

JSP Tutorials

JSP Interview : JSP Interview Questions -2
JSP Interview : JSP Interview Questions -2       Page of the JSP Interview Questions... and well-defined way. The JavaServer Pages specification extends the Java Servlet 

Java Interview Questions

Java Servlets - Java Interview Questions
" THE JAVA CLASS CANNNOT EXTENDS ANY PREDEFINED THIRDPARTY API CLASS OR INTERFACE". 3...Java Servlets  1.What is Pojo class? How and where it is used? 2.Can... where can i download NetBean 5.5.1?  Pojo class is normal java 

Java Interview Questions

interview - Java Interview Questions
interview  kindly guide me some interview questions of Java 

JSP Interview Questions

jsp - JSP-Interview Questions
embedded Java code directly. The use of a standardised tag set, rather than...;Hi,The JavaServer Pages Standard Tag Library (JSTL), is a component of the Java EE Web application development platform. It extends the JSP specification 

Core Java Tutorials

Important Interview Questions in Core Java
Important Interview Questions in Core Java Core Java refers... questions. Mastering in Java is a different thing and facing an interview... who are master in advanced java as whenever you go for the interview 

Java Interview Questions

interview questions - Java Interview Questions
interview questions for Java  Hi Any one can u please post the interview point of questions.Warm Regards, Satish 

Java Interview Questions

java - Java Interview Questions
java  what is mean by static variables in java why it is needed 

Programming Tutorials

Core Java Interview Question, Interview Question
;    Core Java Interview Questions and answers We are constantly trying to provide best Core Java Interview questions... 13 What is an Iterator interface?   Core Java Interview 

Interview Questions

Core java Interview Questions
Here are the Core Java Interview Questions that can be asked to you by interviewers. These frequently asked Core Java Interview Questions will be beneficial... development. Q 2. What is an interface in java? Interface in Java is the collection 

Java Interview Questions

JAVA - Java Interview Questions
JAVA  i need objective Questions and answers ( with 4 or 5 choice) in JAVA. Can anyone help me?   H1!! pl. mail your email id to asciimails@gmail.com. I will send you within 2-3 days. Krishna 

Java Tips and Examples

Interface in Java
Interface in Java       In this section we will learn about Interface and Marker Interfaces in Java. This tutorial will clarify your questions "What is marker Interface?" 

Java Interview Questions

interface
is achieved by using the interface (by implementing more than one interface at a time...interface  what the use of interface?   An interface is one... variables.Any class can implement(inherit)the interface and make use 

General

Jakarta Struts Interview Questions
Jakarta Struts Interview Questions   ... applications with Java. Q: What is ActionServlet? A: The class... database, or interface with J2EE, etc) and then determine where to go next. Even 

Java Interview Questions

Diff Bn Marker Interface and instanceOf - Java Interview Questions
Diff Bn Marker Interface and instanceOf   Hi Friends, Wats d difference bn Marker Interface and instanceOf method. Thanks 

Java Interview Questions

java - Java Interview Questions
java  java's multithreading system is built upon_____class and________interface 

Java Interview Questions

use of synchronozation - Java Interview Questions
"); } } class MyThread extends Thread{ Share s; MyThread(Share s,String str){ super...(String str){ for(int i=0;i<5;i++){ System.out.println("Started :"+str... MyThread(s,"Thread3"); } } class MyThread extends Thread{ Share s 

Servlet Interview Questions

java servlets - Servlet Interview Questions
java servlets  is it possible sending requestdispatcher from one page... in this method i am using the requestdispatcher interface and forward to another... extends HttpServlet { public void doGet (HttpServletRequest request 

Java Interview Questions

difference between marker and tag interface - Java Interview Questions
); } Marker Interface In java language programming, interfaces with no methods.../master-java/interface.shtml Thanks  Hi friend, Tag interface... interfaces from the Java programming language is the Serializable interface 

Servlet Interview Questions

Y servlet as a controller - Servlet Interview Questions
Y servlet as a controller   Hi Friends, Can anyone tell me why... for further forwarding rather than presenation.It can access to both the user interface and the data.To generate the user response,servlet is required 

Java Interview Questions

connection pooling - Java Interview Questions
that implements the ConnectionPoolDataSource interface. The ConnectionPoolDataSource would return a Connection object that implemented the PooledConnection interface...); for(int i = 0; i < 5; i++) { gObjPool.addObject 

IDE Questions

some interview questions - IDE Questions
some interview questions  1. Briefly describe your ideal job? 2. Why did you choose this career? 3. why would you want to work here? 4. why should we hire you over others waiting to be interviewed? 5. why 

IDE Questions

some interview questions - IDE Questions
some interview questions  1. Briefly describe your ideal job? 2. Why did you choose this career? 3. why would you want to work here? 4. why should we hire you over others waiting to be interviewed? 5. why 

Java Interview Questions

help plz - Java Interview Questions
. the program than outputs the digits of the number, one digit per line . for example, if the input is 3245, the output is: 3 2 4 5 3)a milk carton can... . the program than output the string in the reverse order . for exampele 

Java Interview Questions

java - Java Interview Questions
Helpful Java Interview questions   Need Helpful Java Interview questions 

Java Interview Questions

java - Java Interview Questions
java  why java is not fully object oriented language.   Dear java is fully object oriented but its not a pure object oriented. bcz java supporting premitive data types. thanks Rajkumar 

Java Interview Questions

help plz - Java Interview Questions
. the program than outputs the digits of the number, one digit per line . for example, if the input is 3245, the output is: 3 2 4 5 3)a milk carton can... . the program than output the string in the reverse order . for exampele 

Java Interview Questions

in java - Java Interview Questions
is a multiple of th first and false otherwise. plz thank for all   Hi...; } } ------------------------- read for more information, http://www.roseindia.net/java 

Java Interview Questions

java - Java Interview Questions
java  why notify() and notify() methods are written in Object class not in Thread class 

General

Java Interview Questions - Page 1
Java Interview Questions - Page 1       Java Interview Questions by Inigo Nirmal...: Why Java does not support multiple inheritence ?  Answer: Java 

Java Beginners

Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public 

Java Beginners

Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public 

Servlet Interview Questions

java - Servlet Interview Questions
java  Which interface or class is implementing or extending ServletContext interface 

Hibernate Questions

why to use hibernet vs jdbc
can store data into catch for better performance whereas in JDBC you need to implement your java cache. 4) Development is faster in Hibernate than JDBC. 5...why to use hibernet vs jdbc  plz send me the reply   Hi 

Advertisements Advertisements
 

 

 

DMCA.com