Why are there 2 methods to create thread ?

Hi,
To create threads, there are two methods
1) Inherit the THREAD super-class
2) Implement the interface RUNNABLE.
The reason for providing two methods is that, the user can only one level of "implementation inheritance". That is the reason, which comes immediately to mind. But is there another reason(s)? If yes, than what is the reason??
Any help would be welcome
Thanks in advance

I was one of those authors. We all read some other
author who said the same dumb thing LOL, been there, done that, you have my sympathy :-)
Could you explain your use of the words "policy" and
"mechanism"? I completely agree with your conclusion,
but don't really understand your argument.This is one of the things that I've taken from my experiences with the X Window System (tm, I think). "Mechanism, not policy" was one of the mantras that would be repeated by every author. As I understood it, the idea was that the X protocol, Xlib, and even Xt prescribed the mechanism for a program's interaction with windows on a client screen, but did not prescribe how those windows would interact with the user. That was the "policy" to be implemented by the toolkit and application layers (thus the different appearance of Motif, OpenLook, Xaw, &c, even though they used the same underlying code up through the toolkit).
I like the mantra, and as I've come to understand OO programming, I try to apply it as a way to identify what could/should be abstracted and what needs to remain concrete. If something abstracts a basic service that can be used in multiple ways -- like threads -- I consider that mechanism. If something is closely tied to the way my application works, I consider that policy. The former are implemented with interfaces and abstract classes, and do not contain application-specific code; the latter are implemented with instantiable classes.

Similar Messages

  • Why are there 2 ways to create threads?

    Hi,
    To create threads, there are two methods
    1) Inherit the THREAD super-class
    2) Implement the interface RUNNABLE.
    The reason for providing two methods is that, the user can only one level of "implementation inheritance". That is the reason, which comes immediately to mind. But is there another reason(s)? If yes, than what is the reason??
    Any help would be welcome
    Thanks in advance

    I think that the main reason is that java does not support multiple inheritance. If you need to have a thread functionality and facilities from another class except Thread simultaneously you can do it implementing Runnable and extending other class in your class.

  • Why are there 2 folders created - the photo library and the synced folder

    Why are there 2 folders created on the iPhone during a sync?  The photo library and the synced folder both show up.

    Thanks for your help mate
    This is what I've got, should I modify it?
    Thanks again BDAqua,
    Have a G'day

  • Why are there two separate JWS forums?

    There's this forum and http://www.javadesktop.org/forums/forum.jspa?forumID=45 - shouldn't they be merged? Why are there two? Which one is the "official" one?

    This forum, (the java developers forums) pre-date javadesktop.org, and as can be seen by the total thread count (5000+ threads vs 64 topics) has a lot more activity on the yopic of Java Web Start.
    Javadesktop.org was created in 2003, and since it has much overlap with generic java development they also created a thread in their forum for Java Web Start.
    /Andy

  • Why are there lock icons on all of my Bridge Presets?

    Why are there lock icons on all of my Bridge Presets?

    CynthiaRovira,
    As you can see, the original post, almost a year old already, received no replies.  That is undoubtedly due to the total lack of details and the cryptic nature of the message.
    I cannot imagine what this is all about.  What presets?  Where do you see this icon? In the application itself or when looking at the preset folder in your OS navigator (Apple's Finder, Win Explorer)?  What does it look like, a padlock or a circle with a diagonal through it?
    Please provide both a screen shot of the issue and some sensible information.  We don't even know what your platform is Mac or windows.
    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    A screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    My clairvoyant and mind-reader hats are still at the cleaner's.
    Thanks!

  • HT1386 why are there 0's in some folders that i put photos in in iPhoto when I veiw it in iTunes?

    why are there 0's in some folders that i put photos in in iPhoto when I veiw it in iTunes?

    Those files should be being created in folders of the form:
    <User's Music>\iTunes\Album Artwork\Cache|Download\<GUID>\<##>\<##>\<##>
    The <GUID> in your case is 0CDB362F24AD473A...
    If they are appearing anywhere else I would suspect a permissions problem. iTunes just spits them out where it can. Similar problems can sometimes cause it to drop files on the desktop.
    Repair Permissions
    Right-click on your main iTunes folder and click Properties, then go to the Security tab and click Advanced. If necessary grant your account and system full control to this folder, subfolders and files, then tick the option to replace permissions on child objects which will repair permissions throughout the library. This is the XP dialog but Windows 7 shouldn't be too different.
    Once you've repaired the permissions search for all files of the form *.itc2 in the music folder and delete them, then start iTunes. iTunes will rebuild the artwork cache in the correct location as you scroll through your library.
    tt2

  • Why are there so many more choices on the USA iTunes Store? Surely having an iTunes account should let you access all itunes availability the world over? Also how do you request films/tv series to the UK itunes?

    Why are there so many more choices on the USA iTunes Store? Surely having an iTunes account should let you access all itunes availability the world over?
    Also how do you request films/tv series to the UK itunes? There's tv series I'd like but they're incomplete like The Batman &amp; Xena Warrior Princess. And films theta aren't available for download but you can purchase in a store like HMV?  Apple isn't doing itself any favours by secluding countries by their store. They'd make billions if you could just select the iTunes Store you want to search &amp; purchase from just by signing in! If anything what they're doing is putting themselves into a corner, other companies like Samsung &amp; HTC are already on too of them for innovation &amp; ease of use. The people they're attracting are predominantly existing Apple users not new customers. What do you guys think?

    It's not Apple's choice, they can only sell a particular item where the content provider/rights-holder has granted them a license to sell them. Content is licensed by the rights-holders to Apple on a country-by-country basis, each country therefore has to have its own store, and you have to be in a country to use its store - they want control over where their content is available.
    You can try requesting that an item be added to the UK store via this page, but unless the rights-holder agrees to then Apple won't be able to sell it here : http://www.apple.com/feedback/itunes.html

  • HT1222 Why are there error while updating my ipad

    Why are there error while updating my ipad from 5.1 to 7.1.1

    Because something is wrong...
    You can check here for troubleshooting information on specific error messages: http://support.apple.com/kb/ts3694

  • Why are there so many flash updates?

    Why are there so many Flash updates… I have had two in the last week and at least one more since the start of the year. It seems to have really got silly this last 12 months, is Flash really that unsecure and unstable that it needs this many fixes and updates?
    I know you can tick the install in background box when updating but I like to know what is going onto my computer and given Adobe's knack of crashing my system when using PS and AI I don't really want them silently installing anything.

    99% of the time the update gets prompted by Youtube or BBC when videos won't play on there sites and I follow the links through them. You would like to think that big sites like these would not allow false links to malware to crop up, but it isn't out of the question. Next stop, up to date anti virus…..
    As far as Youtube goes I thought they had adopted HTML 5 now as standard and didn't rely on Flash?

  • If i am the only user and owner of my macbook, then why are there 78 users in the directory editor?

    Hi guys just wanted to know little bit about the open directory as my MacBook Pro has been playing up on and off at least a couple of years.  I have been advised by Apple over the phone or as well as over the genius bar in trying to get my mac to behave.  This normally solves whatever problem that has been happening at the time. "Great, job done!"...  Not so much, as another problem eventually shows it's ugly pixelated face again and then we end up going round the Infinite loop ride one more time...  And this ride ain't always free!  I have forked out about £600 on it so far and it wasn't cheap in the beginning!  Anyway I have just got off the ride and before I get punched by a plyst to get back on I would rather learn about the things I don't understand so hopefully I can resolve the matter without hair loss.  So my main question so far is why are there 78 user names (most of which are computer related names, not all) are found in Directory Utility?  I do not play games on my Mac it is mainly used for media such as iPhoto, iTunes, pages, mail and surfing the net.  So which out these 78 users do I select as a server?
    If you have any suggestions or pointers then please post a reply.
    Thanks for reading
    Orion

    So which out these 78 users do I select as a server?
    None. It's normal. Make no modifications.
    It's not clear what trouble you are experiencing, or if anything is wrong at all. If your Mac is not behaving as you expect it should, describe what's wrong in as much detail as possible.
    Include all relevant details regarding your MacBook Pro starting with which one of its three dozen models you have. Posting the results of EtreCheck will help with that. Read about it here.

  • Why are there duplicates in my calendar?, why are there duplicates in my calendar?

    Why are there duplicates in my calendar?

    Is it possible that you or someone copied them to that folder or an automated progress making a backup to that folder.  Normally if you upload the photos then will be stored in your iPhoto library folder. 

  • Why are there no CC Apps in my Creative Cloud Folder?

    Why are there no CC Apps in my Creative Cloud Folder? Just finished cramming Adobe Creative Cloud Flash Professional info. Tried to use it and found that it wasn't in my Apps Folder, nor anywhere else. During my search I discovered that none of the other CC apps were there either. All CS6 Pro apps are there, but no CC.
    IMac 21.5" desktop;  OSX 10.8.5;   2.5 GHz Intel Core i5:   1333 MHz;   4 GB DDR3;   500 GB HD + 500 GB external HD 

    Could you try to scroll down a bit and look into the "Find New Apps" section. I have attached a screenshot for your reference.
    In case you still do not see any CC applications, login to https://creative.adobe.com/products and try to download any CC app and then check if it gets installed and you see it under the "Your apps" section of CC desktop app.

  • Why are there itunes store charges on my credit card statement but there are no purchases under my itunes account?

    Why are there itunes store charges on my credit card when there are no purchases under my itunes account?

    Have you added or changed your card details on your account and they are temporary store holding charges ?
    Unknown charges : How iTunes Store charges might look on credit and debit card statements

  • Why are there shadows at the bottom of my screen?

    why are there shadows at the bottom of my screen and how do I get rid of them?

    take a screenshot and post it.

  • Are there any shortcuts for creating Value Object Classes?

    Hi,
    I'm using a Remote Object to connect to my server
    (pyAMF/Django). I'm getting stuck with the creation of Value Object
    Classes. It doesn't seem very DRY to have a class on my server
    representing the data model and then have to recreate that class
    and all its properties in my Flex app.
    Are there any shortcuts for creating client side VOs from
    server side data?
    I was thinking about declaring an empty VO class in Flex, and
    then dynamically assigning/casting my Proxy object to that class.
    It seems like that approach may cause problems for the Flex
    compiler though.
    Any hints?
    Thanks!

    quote:
    Originally posted by:
    tptackab
    Oh man, do I feel your pain. I'm not sure what middle-tier
    technology you're using, but I'm using Java (w/Spring) and I
    absolutely hate having to create and maintain two sets of VO (aka
    data transfer - DTO) object for Java and Flex.
    One thing that has helped me in that area is a free tool from
    Farata Systems called
    DTO2Fx. If you're using Java and Eclipse, it's a great time saver.
    You simply install a (very lightweight) Eclipse plugin, add a
    single annotation to your Java VO classes, and it automatically
    generates your Flex VOs. It even creates a base and extended
    version of each VO on the AS3 side so you can add code to the
    extended VO without fear of having your changes overwritten when it
    regenerates your Flex VOs.
    Here's a like to thier
    PDF that
    gives instructions and a download link. I had it up and running in
    my application in less than 30 minutes!
    I'm using Python/Django serverside (PYAMF is my AMF
    serializer).

Maybe you are looking for

  • Unable to add wav audio clips to Audio1 timeline

    I am mystified as to why Encore is not letting me place specific .wav files into the Audio 1 timeline. Encore will let me put the files into the Audio 2 timeline, just not Audio 1. The wav files that cannot be placed in the Audio1 timeline have been

  • Kernel Panic when i open screen

    Hi all So my computer was running fine today, but after moving between classes, i re-opened my laptop and a kernel panic screen popped up. So i restarted, and when the option to report came up, i clicked the report button. No log popped up or anythin

  • Want to lock objects in a particular devlopment class

    Hi Experts, I have a scenario where we are moving certain objects to a new development class - 'NEW_DEVCLS", and we have to make sure that these objects are not allowed to be edited.. That is, it should throw a lock or not authorised message to devel

  • Xpress Music 5800 new firmware (V51.0.006)problem

    guy, i have this problem after updating my phone. - my music player keep repeat song even i make repeat off - hang when try to change radio station channel those who have this problem and have the solve, hope can give me some advice. Thanks

  • Non-apple devices doesn't set up internet conenction

    I created a new wlan with the Airport express. All devices can connect with the wlan, but the non-apple devices (galaxy s2 and ps3) doesn't have internet. On the MBP, where i configurated the wlan, internet is running. how to fix this issue?