Apple Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
3
of 3 vote

If you implement the Runnable interface, you can only override and use the run() method. However, if you wish to use method related to parallel processing, the Thread class would be useful. The thread class provides methods like activeCount(),destroy(),dumpStack().. etc. Hence, if you need to use more than just the run() method, the thread class is useful.

- MS February 28, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

true

- Anonymous April 19, 2011 | Flag
Comment hidden because of low score. Click to expand.
2
of 2 vote

Runnable is just an interface with run() method. Thread is the actual class with all the important methods to handle threads.

- running September 27, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Runnable is used to make sure that run method is implemented in class. We need thread instance to create new thread( it create separate stack and thread related stuffs)

- Venkat January 20, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 3 vote

if a class implements Runnable u can extend other classes which you might need..but if you write a thread code by extending threads..u cant extend any other class..

- Newbie January 20, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

obviously, class and interface is different. Interface is more abstract, so you have to define your own methods in class

- Anonymous January 20, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I totally agree with newbie !! Thats the perfect answer for it !

- Sreekanth January 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

first read question dude....

- sauravmanit January 23, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

The answer should be to create and start the thread you need a class, and that is done by the Thread class.

- dantepy April 27, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I really think in new version of JDK the thread call can be option to create a new thread because we should be able create a thread just implementing an interface or even using an annotation. The code to create a thread is should not imposed to application developer rather should be handle at JVM level by annotation processing tool like when annotate class with @Servlet it become a servlet in servlet 3.0 spec.

- Tarun April 27, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

when we use create thread by using Thread as class we need to extend it.
when we use create thread by using Runnable as class we need to implement it.
In place where it is need to extend more than one class we use Runnable interface.

- durai November 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A class that implements Runnable is not a thread and just a class.For a Runnable to become a Thread, You need to create an instance of Thread and passing itself in as the target

- Anonymous March 02, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Java does not support multi-inheritance so a possible reason

- Anonymous June 23, 2019 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More