Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Question on topic Collection & Thread within the Java forums, part of the Software Development category; Hi all, I have following issues, for which I need solutions. PLease take kind attention to answer.. 1) To achieve a java.util.HashMap object I can use two different statements, viz, ...
|
|||||||
|
|||
|
Question on topic Collection & Thread
Hi all, I have following issues, for which I need solutions. PLease take kind attention to answer..
1) To achieve a java.util.HashMap object I can use two different statements, viz, a) Map hashMap = new HashMap(); b) HashMap hashMap = new HashMap (); Issue: Among the two, which technique is recommended & advantageous & why? 2) To create a thread Object one way is implementing 'Runnable' interface. The Runnable interface contains only a single abstract method run(); Thus the normal statement to create my own class for thread is: class MyThread implements Runnable{ // code for thead instantiation & call to start & so on.. } My Search: -------------- Instead of implementing Runnable I will write my Interface containing run() abstract method. like: interface MyRunnable{ void run(); } class MyThread implements MyRunnable{ // code for thead instantiation & call to start & so on.. } Issue: ----------- When I do this I got compilation error like(in my words): could n't find Thread(this,Sting) Please find me the reasons. Thanx & Regards |
| Sponsored Links |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to answer this question | sripri | Interviews | 7 | 09-01-2009 02:06 AM |
| Swing Question | Informatiker | Java | 2 | 09-16-2006 03:53 PM |
| Question with Games | StephenRaj | Unix/Linux | 1 | 08-20-2006 01:19 AM |
| Question with EOF | RyanJames | C and C++ | 1 | 07-16-2006 12:32 PM |
| thread safe | mnj_rt | Java | 1 | 06-17-2006 07:36 AM |