logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • Explain different ways of creating a thread. Which one would you prefer and why ?


  • Correct Answer
  • There are three ways that can be used in order for a Thread to be created: A class may extend the Thread class A class may implement the Runnable interface An application can use the Executor framework, in order to create a thread pool The Runnable interface is preferred, as it does not require an object to inherit the Thread class In case your application design requires multiple inheritance, only interfaces can help you Also, the thread pool is very efficient and can be implemented and used very easily 


  • Technology problems


    Search Results


    • 1. What are pass by reference and pass by value ?
    • Discuss
    • 2. What is dynamic method dispatch?
    • Discuss
    • 3. What is the similarity between Dynamic Binding and linking?
    • Discuss
    • 4. What is Shallow and deep cloning in Java?
    • Discuss
    • 5. Why do we need wrapper classes in Java?
    • Discuss
    • 6. What is the difference between processes and threads ?
    • Discuss
    • 7. What are the basic interfaces of Java Collections Framework ?
    • Discuss
    • 8. What do you know about the big-O notation and can you give some examples with respect to different data structures ?
    • Discuss
    • 9. What?s the difference between Enumeration and Iterator interfaces ?
    • Discuss
    • 10. What is the output of this program ? class main_arguments { public static void main(String [ ] args) { String [][] argument = new String[2][2]; int x; argument[0] = args; x = argument[0].length; for (int y = 0; y < x; y++) System.out.print(" " + argument[0][y]); } }

    • Options
    • A. 1 1
    • B. 1 0
    • C. 1 0 3
    • D. 1 2 3
    • Discuss


    Comments

    There are no comments.

Enter a new Comment