Help needed understanding final keyword and  use 3

Hi Everyone,
I have been studying a book on multi-threading and have inadvertently come accross some code that I don't really understand. I am wondering if anybody can explain to me the following:
1). What effect does using the final keyword have when instantiating objects, and
2). How is it possible to instantiate an object from an interface?
public class BothInMethod extends Object
     private String objID;
     public BothInMethod(String objID)
          this.objID = objID;
     public void doStuff(int val)
          print("entering doStuff()");
          int num = val * 2 + objID.length();
          print("in doStuff() - local variable num=" + num);
          // slow things down to make observations
          try{
               Thread.sleep(2000);
          }catch(InterruptedException x){}
          print("leaving doStuff()");
     public void print(String msg)
          String threadName = Thread.currentThread().getName();
          System.out.println(threadName + ": " + msg);
     public static void main(String[] args)
          final BothInMethod bim = new BothInMethod("obj1");  //Use of final on objects?
          Runnable runA = new Runnable()      //Creating objects from an interface?
               public void run()
                    bim.doStuff(3);
          Thread threadA = new Thread(runA, "threadA");
          threadA.start();
          try{
               Thread.sleep(200);
          }catch(InterruptedException x){}
          Runnable runB = new Runnable()
               public void run()
                    bim.doStuff(7);
          Thread threadB = new Thread(runB, "threadB");
          threadB.start();
}If you know of any good tutorials that explain this (preferably URL's) then please let me know. Thanks heaps for your help.
Regards
Davo

final BothInMethod bim = new BothInMethod("obj1");  //Use of final on objects?
Runnable runA = new Runnable()      //Creating objects from an interface?          
     public void run()               
                                bim.doStuff(3);               
};Here final is the characteristics of bim reference variable and it is not the characteristics of class BothInMethod
This means u cannot use bim to point to some other object of the same class
i.e, u cannot do this
                   final BothInMethod bim = new BothInMethod("obj1"); 
                   bim  =  new   BothInMethod("obj2");  This bim is a constant reference variable which will point only to the object which it is initialized to
and not to any other object of the same class later on.
How is it possible to instantiate an object from an interface?Regarding this yes we cannot create an object from an interface but
but here it is not an interface u are providing the implementation of the interface Runnable
as
new Runnable()
}This now no longer stays an interface but now it is an object that implements the interface Runnable

Similar Messages

  • Color management help needed for adobe CS5 and Epson printer 1400-Prints coming out too dark with re

    Color management help needed for adobe CS5 and Epson printer 1400-Prints coming out too dark with reddish cast and loss of detail
    System: Windows 7
    Adobe CS5
    Printer: Epson Stylus Photo 1400
    Paper: Inkjet matte presentation paper with slight luster
    Installed latest patch for Adobe CS5
    Epson driver up to date
    After reading solutions online and trying them for my settings for 2 days I am still unable to print what I am seeing on my screen in Adobe CS5. I calibrated my monitor, but am not sure once calibration is saved if I somehow use this setting in Photoshop’s color management.
    The files I am printing are photographs of dogs with lots of detail  I digitally painted with my Wacom tablet in Photoshop CS5 and then printed with Epson Stylus 1400 on inkjet paper 20lb with slight luster.
    My Printed images lose a lot of the detail & come out way to dark with a reddish cast and loss of detail when I used these settings in the printing window:
    Color Handling: Photoshop manages color, Color management -ICM, OFF no color adjustment.
    When I change to these settings in printer window: Color Handling:  Printer manages color.  Color management- Color Controls, 1.8 Gamma and choose Epson Standard it prints lighter, but with reddish cast and very little detail and this is the best setting I have used so far.
    Based on what I have read on line, I think the issue is mainly to do with what controls are set in the Photoshop Color Settings window and the Epson Printer preferences. I have screen images attached of these windows and would appreciate knowing what you recommend I enter for each choice.
    Also I am confused as to what ICM color management system to use with this printer and CS5:
    What is the best ICM to use with PS CS5 & the Epson 1400 printer? Should I use the same ICM for both?
    Do I embed the ICM I choose into the new files I create? 
    Do I view all files in the CS5 workspace in this default ICM?
    Do I set my monitor setting to the same ICM?
    If new file opens in CS5 workspace and it has a different embedded profile than my workspace, do I convert it?
    Do I set my printer, Monitor and PS CS5 color settings to the same ICM?
    Is using the same ICM for all devices what is called a consistent workflow?
    I appreciate any and all advice that can be sent my way on this complicated issue. Thank you in advance for your time and kind help.

    It may be possible to figure out by watching a Dr.Brown video on the subject of color printing. Adobe tv
    I hope this may help...............

  • Need help on understanding COLUMN_IID, COLUMN_ID and ROW_IID

    Dear All,
    I need some help in understanding the below three things.
    COLUMN_IID, COLUMN_ID and ROW_IID
    First let me write down the requirement :
    I need to keep track of the scores on various status change.
    In the design of the template, we have something called 'Company Objectives' and 'Team Objectives' and 'Individual Objectives'.
    And under every heading, there are some objectives and a score beside it.
    When the document is with the employee, then he/she decides the score (0-Not started and 5-Completed). And when the employee submits the document then it goes to manager. The manager may change the score against an objective.
    Now, the requirement is with every change of status and substatus, i need to take a note of the score. Is this value stored in any standard table. I checked the table HRHAP_FURTHER but i cannot
    When i check the Function Modules 'HRHAP_DOCUMENT_GET_DETAIL' and 'HRHAP_DOC_FURTHER_READ', then i see those values but against various ROW_IID and COLUMN_IID and COLUMN_ID. I need to know how to catch the ROW_IID and COLUMN_IDD and COLUMN_ID for a particular objective. And what is the concept of the ROW_IID and COLUMN_IID and COLUMN_ID.
    Please let me know if something is not very clear. I will try to give some more explaination.

    Hi,
    For the context, in case it was not clear in the original message, we are talking Performance Management.
    As you know the documents are based on appraisal templates. On document create this template is read and the different elements are generated. As we can have the same element type/id multiple times in a template/document we need something to uniquely identify them. This is done via the ROW_IIID.
    Then for each element we can define which columns we use. A column is identified with COLUMN_ID, which i9s unique when we are on template configuration level. But on document level this is not the case. Due to the Part Appraiser columns (PAPP/PFGT) being multiplied by the number of part appraisers in the document the COLUMN_ID is not unique anymore. So we need to give them also a unique ID, which is the COLUMN_IID.
    Thats the short answer, I will write a longer document on it one of these days in my blog.
    Regards and Groetjes,
    Maurice Hagen

  • NEED HELP Deciding. new final cut and a powerpc4

    I have a power mac G4 and I want to know will the new final cut package work on it? My pc has a radeon 9000 pro, dual 1.25 processors,, memory 1.25.
    i just want to know if final cut and the other programs will work on it. I do not do HD and when i do i will buy another but for Sd is this ok to run and buy the new fc.
    thanks everyone who can help

    I'd think you will be able to run FCS 2. Your computer is above all of the minimum specs, only wild card here is your graphics card. It has enough VRAM ... just not listed in the compatible cards. Bet it works OK though. Look at the Motion and Color minimums. FCP will work without a hitch in any event, and so should compressor, LiveType, and DVD SP. You could upgrade it if you find it lacking but I'd give it a go with the card you have to see if you're OK first.
    http://www.apple.com/finalcutstudio/specs.html
    Jerry

  • Need Ideas for creating and using Custom Business Object

    Hello Guys,
    I am developing an application which uses a Request->Approve->Create approach for creating Purchase documents.
    Now I am a little puzzled about how to make use of the Business Object BUS2014.
    The application I am developing has its own unique 'Request Number'  (say REQID)  which will point to the Request for Creation of a purchase order.
    Whenever a Request is created (from a Z-Tcode) a workflow needs to be initiated and it has to be sent to the approver.
    The Purchase Document will be created once the approver approves.
    Now my confusion here is, if I use BUS2014, the object will be instantiated only during the final step of the workflow. But I need an instance during the beginning of the Requestor ->Approver negotiations as I am playing with events. These events needs an Object_key.
    How should I proceed here?
    Should I create a new logical Business Object like ZPOREQ where I have the above mentioned REQID as the key?
    And should I have an attribute of type BUS2014 inside the custom BO?
    How will I make use of the methods like BUS2014.Create etc which I may need to create the purchase document?
    Any small direction will be a huge help for me to get used to this wilderness.

    Hi,
    You should continue with the ABAP class idea. The business objects are kind of "obsolete" already, and if there is a need to create a new "object", ABAP classes are the way to go. Business objects are still useful, but I normally use them only when an existing standard business object fulfills the requirements (possibly with slight additions) which is almost never. 
    From my point of view you can use the existing class. Depending on the circumstances I normally have just one class that I use for both workflow and the possible other functionality that is required, but you have to understand that I have this goal in my mind already when starting the development process. As your class most probably has many useful features already (such as you have the header and item data as attributes etc. (if I understood correctly?), these are also useful in in workflow (class attributes will be available in WF container etc.). 
    If you are hesitant to use the same class directly in your workflow, you could also create a new class ZCL_REQUEST_FOR_WF (with the workflow interface), and then simply add your existing class ZCL_WF_REQUEST as an attribute to this new class. Then this new workflow class could include the pure workflow stuff, and your existing class the non-workflow stuff. But this most probably will not make much sense - just implement the if_workflow interface in your existing class (this is just one possibility that you might consider.)
    Regards,
    Karri

  • Urgent help needed! How do I use Time Machine to restore my System disc?

    I need urgent help. First I discovered that my Library folder was empty. When I tried to restore the library to an earlier version via Timemachine it would not let me because it said the system was in use. Trying to start-up from another system on another internal drive and using various disc repairs resulted in the whole volume to disappear.
    Question is how do I get the earlier system from my Timemachine backup drive? I have another Mac where I can attach the TIme machine HD to. Can I restore it from there and then copy the files over to my corrupted disc? All my programs are on there as well, which would take me days to re-install and then there are the other bits, emails, photos etc. Can anyone help?

    lightandmagic wrote:
    Thanks for your sympathy Pondini and the encouragement. You just reminded me that I will lose a whole working day restoring !!! Do you happen to know where the emails are kept on the system and the address book? I better nick those as well as my other life sustaining bits before its too late. I don't trust anything any more.
    I don't know what you mean by "nick those." Time Machine will put everything back the way it was at the time of the backup (unless you'd excluded things).
    Do you mean you want to restore things from the period after the backup you selected?
    For Address Book or Apple Mail, start the application, then +Enter Time Machine,+ navigate to your latest backup, and you'll have a prompt to restore. For Mail, you can restore an entire mailbox. When you exit from TM, you'll see a new folder in your Mail sidebar with the restored items, so you can sift through them and move, delete, or leave them as you wish.
    Other items, you'll have to locate and restore via the Finder > Time Machine.

  • Can someone help me understand how I can use cable cards with external digital tuners?

    Here's my situation.  I currently have a PC with an internal TV tuner card.  I connect the internal TV tuner card to a standard QIP2500-2 Set Top Box.  I've never been very happy with this setup, although it mostly works.  But,  I can only record or watch one channel at a time.  In addition, changing channels requires a silly IR blaster so changing channels from Windows Media Center uses the IR remote signals to change channels on the set top box.
    I was thinking I could use a product like this together with a cable card from Verizon, eliminating the set top box.  I read the FAQ here but I am still unclear about how cablecards work and what capabilities they enable.  My questions are:
    1) The FAQ says using a cablecard eliminates the use of the online TV guide.  How then does one schedule recordings in windows media center?  It would seem silly to have to still have a STB just to get the program guide.  What do others do about this?
    2) Are the cable cards provided by Verizon compatible with the above product shown in the link?  The Verizon FAQ says the device must be marked "DCR" to be compatible, but looking at all the digital tuner products at NewEgg, none of them seem to be marked with "DCR".  They say, "m-CARD".
    3) What are others out there doing to utilize FIOS TV with a computer and not have a set top box?
    Thanks for any insight!

    I haven't used the SiliconDust product, but I have been using a similar product by Ceton, for nearly five years.
    By inserting a CableCARD into the tuner, you would have access to the same channels as a set-top box. You rent a cableCARD from Verizon, just like you'd rent a set-top box from them. I have an m-card, which just allows multiple channels to be tuned at once, unlike the older s-card.
    You do, however, lose Pay Per View and on-demand programming. For me, it's not a great loss.
    The program guide is handled through Windows Media Center, which holds programming data for the next 14 days. You schedule your recordings there. It's also smart enough to reschedule shows, if there's a recording conflict (too many scheduled shows, not enough tuners)
    Although you can contunue to use an IR blaster (I use one), you can also get a Media Center companion app from Ceton. It doesn't require a Ceton tuner...it will still control Media Center. The app costs a few bucks, but it's worth it. They make it for Android and Apple, and maybe Windows Phone. It will let you manage your schedules, and use your phone/tablet as a remote control over WiFi.
    Buy a big hard drive to hold your scheduled recordings. Expect to use an average of 10-15 gigabytes per hour of HD recording. The beauty of this system, is that you can just add another hard drive whenever you need more space, sonething the STB's won't let you do.
    For service in other rooms, use an Xbox360 if you have one. Or, buy a Ceton Echo extender (again, doesn't require a Ceton tuner). Don't use Wi-Fi for your extenders. Wired Ethernet is a must...most wireless won't be able to keep up.
    Hope this helps.

  • Help Needed "Camera not asking to use photo location when switched on"

    Hey guys, any help would be greatly appreciated.
    When I turn on my camera app it used to ask if I wanted to use the location. Now it does not, I am interested in seeing what I can do with the geotagging feature. I checked my settings, and use location is on. I turned it off, backed out, turned it back on again but nothing changed.
    When I open up maps and click the little round "find me" button, it works great.
    Any ideas on what I can do to get my camera app working again? Thanks in advance.

    If Location Services is ON, the geotagging data should be stored with the pics. The iPhone Photos app cannot display that information - you'd need to use a 3rd party app or upload the photo to a photo sharing website that supports geotagging data.
    If you want to see that 'use location' request from the Camera app, go to Settings > General > Reset and tap Reset Location Warnings.

  • Help needed with ColorEyes Pro and 27" iMac display calibration

    I am trying out a demo of ColorEyes Pro and using it with my Spyder2 puck, but there are a few things I just don't know and/or understand as they don't even ask them when using the Spyder software.
    White Point Target - no idea what this should be
    Gamma Target - 2.2 I am guessing, but not sure
    Black Point Target - no idea on this either
    Also, what should by "brightness" be set too? Or is that a personal thing?
    Thanks in advance...

    Hi Rich, I think it should work that way, but not the other way around...
    Here's how it's supposed to work...
    http://support.apple.com/kb/HT3924
    Mid 2011s & up need Thunderbolt!???
    http://support.apple.com/kb/TS3775

  • Keywording and use of capitals - good practice?

    Before coming to Aperture, I was used to keywording without capitals except for names. I see Aperture's default keywords all come with capitals.
    Looking to the future when metadata starts being read by search engines etc could case sensitivity (if implemented) impact on searches? For examples searches for Mountains not showing mountains.
    I feel the safer option is to not capitalise except for names of places, people,etc.
    What are other people's thoughts on this?
    Ross

    Almost all searches are case insensitive. So it shouldn't affect results.
    That said, I prefer not to capitalize every word. Only proper nouns for the most part.
    I've started to use Controlled Vocabulary (www.controlledvocabulary.com) to help with my keywording and they're not capitalizing so there you go. iStock Photo capitalizes most keywords when I upload, though.

  • Help needed in redoing networking and home entertainment

    I realize that this is a site dedicated to all things Apple, but I am hoping I can't get some honest and impartial help on building the best home network and entertainment system.
    I currently have an XP Media Center desktop computer in an office of my home where all of the network stuff is at and is connected via ethernet. I also have a Mac G4 MDD 1.0 that I am using in another room for Adobe Creative Suite to do my own promotional items and I have about a 50' Cat 6 cable running back to the router in the office. I also have a Vista laptop that is connected wirelessly but believe it is only a "g" network? I don't really use this a whole lot but take it out to job sites and such so there is information I need to send back and forth to my external drives hooked up via ethernet to my router. I am in the process of getting a new MacBook Pro as well.
    I have a PS3 hooked up to my home entertainment center but unsure of how to make everything work the way that I want. Here is what I would like to be able to do. 1) Networking of all computers and external drives, 2) Operate my Mac G4 Wirelessly, 3) Addition of internal bluetooth to G4 so I can get a wireless keyboard and mouse, 4) Ability to play iTunes from external hard drives on home entertainment center, 3) Ability to stream media from internet and hard drives to HDTV in home entertainment center
    I am looking to upgrade my router to dual band with either the Airport Extreme or the Netgear WNDR3700. I don't know which to get and have found about the same amount of pros and cons for each on the web. Any suggestions and why?
    Do I need an Apple TV or a Netgear WNHDEB111 or other Digital Media Reciever???
    What else would you recommend to accomplish my goals and why do you recommend the part and brand that you do.
    Thank you in advance for any and all assistance I can get.

    Hello, I will gladly assist you with these steps. Have you already set the printer up physically? Are the ink cartridges set in and the printer is ready, just waiting to be downloaded to the computer? If you still have the CD that came with the 8600 printer, all you have to do is place the CD in and click SETUP. This will guide you step by step to install. 
    Now the tricky part is how you want the 2 PC's connected. You can go USB (hardwire from printer to computer), Wireless (set the printer up on network and PC on network with NO cords attached, or you can go Ethernet (a cord going from the printer to the router).
    Let me know how you are able to connect, and I can guide you through those steps.
    **Click the KUDOS star on the left to say 'Thanks'**
    Please mark a reply "ACCEPTED AS SOLUTION" if it solved your problem, so others can find it.

  • Help needed in Multiple Receivers sceenarios using BPM

    Hi,
    I am new to BPM. As per my requirement, based on a business logic i may split the messages into two at message mapping. If i have spitted the messages into two, it should go to different receivers. Or if my logic hasnt splitted the mesaage means it should go to any one of the receivers. I also expect response from the receiver system once its done successfully.
    Could you help me how to do this using BPM?
    Thanks & Regards,
    Senthil.

    Hi,
    You can do it without BPM also, by using MultiMapping. If only splitting is required then I would suggest not to use BPM since it will consume much memory. Instead you can use multmapping.
    For Multimapping, go to messages tab in message mapping and select your different target structures and map it as per your requirement. In Integration Directory, go to advanced Interface Determination and proceed.
    Br,
    Madan Agrawal
    Edited by: Madan Agrawal on Feb 12, 2009 8:25 AM

  • Urgent help need:How inventory system and fulfillment system work

    Hi Every one ,
    I have an requirement to work on inventory and fulfillment system,below are my questions,
    1)I have stock level quantity for an sku is 2 ,if one user done with his order with quantity of 2 then how we can show quantity to the second customer (if stock not available we gone loss the business )
    how we can handle this ?
    2)There are few orders are completed(if some are orders are having quantity available in stock some or backorders)
    here how the fulfillment system understand those orders and how it will update the inventory.
    Could you please any one help me how to work on above requirements or else give me some other solutions to full fill above .
    Regards,
    Jyothi Chidurala
    Edited by: Jyothi.mj on May 22, 2013 5:08 AM
    Edited by: Jyothi.mj on May 23, 2013 4:28 AM

    >
    1)I have stock level quantity for an sku is 2 ,if one user done with his order with quantity of 2 then how we can show quantity to the second customer (if stock not available we gone loss the business )
    how we can handle this ?
    you can always call InventoryManager.AVAILABILITY_STATUS_IN_STOCK to check whether the item is available in inventory , It is the business call if item not available how they want to handle this .
    hope this helps

  • SQL08 Need example of creating AND using a Fact (degenerate) dimension

    Can someone post a link to some examples of setting up and using a Fact (degenerate) dimension.  Ive got the SSAS 2008R2 Adventureworks DW project setup and I see a few Fact dimensions in there, but id like some descriptions to go along with this or
    something similar.
    My scenario:
    Orders - attributes include :  Order#, OrderStartDate, SalesPerson, BusinessType, MarketType
    OrderTransactions - attributes include:  OrderKey , TransactionAmount, TransactionType, TransactionDate, AccountKey
    Description:
    Its more or less the typical Order > Order Detail type scenario, with the addition of Orders have some additional attributes.
    So I want to be able to measure on for example:
    Order counts - broken down by BusinessType and MarketType , and then within a date range
    Revenue - which will be totals of transaction amounts, again grouped by BusinessType and MarketType, but also be able to drill down to see the related Order#

    Hi Shiftbit,
    According to your description, you need some examples about create and use degenerate dimensions, right?
    Degenerate dimensions, also called fact dimensions, are standard dimensions that are constructed from attribute columns in fact tables instead of from attribute columns in dimension tables. Here is document that describes how to create and use degenerate
    dimensions step by step, please refer to the links below.
    https://msdn.microsoft.com/en-us/library/ms167409(v=sql.100).aspx
    http://www.jamesserra.com/archive/2011/11/degenerate-dimensions/
    Regards,
    Charlie Liao
    TechNet Community Support

  • Help needed to debug Communication Channel using Seeburger modules

    Hi ALL
    Can you please, help debug the following communication channel using File adapter & seeBurger module.
    Adapter Framework caught exception: I/O operation failed : java.lang.ClassNotFoundException: com.sap.engine.messaging.impl.spi.transport.PasswordCredentialImpl -
    Loader Info -
    ClassLoader name: [sap.com/com.sap.aii.af.app] Living status: alive Direct parent loaders:   [system:Frame]   [service:servlet_jsp]   [service:ejb]   [library:com.sap.xi.util.misc]   [service:com.sap.aii.adapter.xi.svc] Resources:   /usr/sap/KPX/DVEBMGS00/j2ee/cluster/apps/sap.com/com.sap.aii.af.app/EJBContainer/applicationjars/com.sap.aii.af.ejb.jar   /usr/sap/KPX/DVEBMGS00/j2ee/cluster/apps/sap.com/com.sap.aii.af.app/servlet_jsp/AdapterFramework/root/WEB-INF/classes   /usr/sap/KPX/DVEBMGS00/j2ee/cluster/apps/sap.com/com.sap.aii.af.app/servlet_jsp/AdapterFramework/root/WEB-INF/lib/com.sap.aii.af_api.jar -
    Delivering the message to the application using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.services.rmi_p4.exception.P4BaseRuntimeException: I/O operation failed : java.lang.ClassNotFoundException: com.sap.engine.messaging.impl.spi.transport.PasswordCredentialImpl -
    Loader Info -
    ClassLoader name: [sap.com/com.sap.aii.af.app] Living status: alive Direct parent loaders:   [system:Frame]   [service:servlet_jsp]   [service:ejb]   [library:com.sap.xi.util.misc]   [service:com.sap.aii.adapter.xi.svc] Resources:   /usr/sap/KPX/DVEBMGS00/j2ee/cluster/apps/sap.com/com.sap.aii.af.app/EJBContainer/applicationjars/com.sap.aii.af.ejb.jar   /usr/sap/KPX/DVEBMGS00/j2ee/cluster/apps/sap.com/com.sap.aii.af.app/servlet_jsp/AdapterFramework/root/WEB-INF/classes   /usr/sap/KPX/DVEBMGS00/j2ee/cluster/apps/sap.com/com.sap.aii.af.app/servlet_jsp/AdapterFramework/root/WEB-INF/lib/com.sap.aii.af_api.jar
    Your help is greatly appreciated!
    Thank you,
    Patrick

    Hi Patrick,
    It seems that your seeburger instalation was not successfull.
    Try installing it again and make all the libraries are there.
    Regards,
    Luismier
    Edited by: Luismier on Aug 26, 2009 10:57 PM
    Edited by: Luismier on Aug 26, 2009 11:16 PM

Maybe you are looking for