Please help me to know

Hi friends,
I'm new to java, I have seen two programs like below. What is the difference? For both programs same result is comming.
import java.util.*;
class SetInterface{
public static void main(String args[]){
HashSet<Object> set = new HashSet<Object>();
set.add(new Integer(40));
set.add(new Integer(10));
set.add(new Integer(20));
set.add(new Integer(30));
System.out.println(set);
Output:
[30,40.20,10]
mport java.util.*;
class SetInterface{
public static void main(String args[]){
Set<Object> set = new HashSet<Object>(); // See here "I'm using Set Interface....What is the use"
set.add(new Integer(40));
set.add(new Integer(10));
set.add(new Integer(20));
set.add(new Integer(30));
System.out.println(set);
Output:
[30,40.20,10]

ravindra.alld wrote:
here the super class object is refering to the subclass object.Totally wrong.
-- There's no "super class" involved, Set is an interface, not a class.
-- Objects don't refer to objects. Variables reference objects.
@OP: In the second case, the rest of the method is independent of what implementation of Set you use. so in the face of any changing requirement, you could use a ConcurrentSkipListSet / LinkedHashSet / any other kind of Set without changes to the rest of the code.
This assumes greater importance when the code is long and possibly cumbersome to trace through, or the Set is the return value from a method.
The principle I follow is to code to the Interface or Class that provides the method(s) I intend to use. In your case, you are not using any functionality that is specific to HashSet, so I would go with declaring the variable as a Set.
db

Similar Messages

  • I am facing issue in Receiving incoming calls, Name not getting displayed though the same has been saved in my phone book!! I have done sync from Windows contacts.. please help if some1 knows how to rectify the issue...

    I am facing issue in Receiving incoming calls, Name not getting displayed though the same has been saved in my phone book!! I have done sync from Windows contacts.. please help if some1 knows how to rectify the issue...

    Has your carrier been having issues with Call Display? Do the telephone numbers come up when people call, or does it just show 'Unknown Number' or 'Blocked' ?

  • I need to add a new computer and take off a old one but can't find the site or place to turn it off i can only have two computers but i got three please help let me know where to go to shut one off to put the new one on?

    i need to add a new computer and take off a old one but can't find the site or place to turn it off i can only have two computers but i got three please help let me know where to go to shut one off to put the new one on?

    Hello,
    the way is written there Activation & deactivation help >>> (see there only to understand the procedure) Common activation problems >>> "Activation limit reached for [product]. This serial number has already been activated on 2 computers." "Maximum activations exceeded."
    >>> How to deactivate or sign out >>> A single license for Adobe software lets you install the applications on two computers—for example, at home and at the office. However, you can use the software on only one computer at any given time.
    If you want to install the software on a third computer, deactivate the software on the computer on which you will no longer use the software. Then, activate the software on the new computer.
    Hans-Günter

  • My macbook is blocked by pin code, please help, I dont know what to do!

    My macbook is blocked by pin code, please help, I dont know what to do!

    When you enter iTunes on the PC and the iPod icon pops up, right click on it and select "Options". Then click on the Music tab. Once you're in the Music tab check the box that says "Enable Disc Use". This means that you've just turned your iPod into a portable hard drive. Click "Ok" and move your iPod from the PC to the Mac. From there, your iPod should show up on the Mac's desktop right under the Hard Drive icon. Click "File" at the top of the screen and select "Add to Library". Find the iPod hard drive in the selection screen and choose the music folder that's on it. Then just click Ok and all your music will be downloaded. That should do the trick, but you might want to do a Google search on the subject to get a second opinion. Best wishes!

  • Hi, After I installed Mac Lion, I have problem with the tamil font while typing in Neo Office. Especially with the letters "e-Ex: தெ" and "ai-Ex:தை". Please help me I know its not bug from Apple It shd be some problem in neo.

    Hi, After I installed Mac Lion, I have problem with the tamil font while typing in Neo Office. Especially with the letters "e-Ex: தெ" and "ai-Ex:தை". Please help me I know its not bug from Apple It shd be some problem in neo.

    Is your problem due to the keyboard or to NeoOffice Characters? You have to change probably the font. Not all fonts are supporting all Unicode sets. Which font you have in your NeoOffice set to write Tamil? Try with Arial Unicode MS for example.
    Are the letter e-Ex and ai-Ex right in your posting? If they are right, how you inserted these letters in your posting? By copy and paste or by typing? If by typing, your question is related to NeoOffice. Probably you should reinstall or update NeoOffice? Or switch to OpenOffice?
    marek

  • Please help me to know the answers

    Hi ALL,
    Please help me to know the answers
    What is the role of the container element in BPM?
    What  is the difference between Idoc and RFC adapter ? How to decide which one will be used?
    How to restart the adapter engine or J2ee engine?
    What is the role of wndows1 and windows2 in SXMB_MONI?
    Is it possible to see the message after mapping ?If it is possible how to check?
    Regards,
    Somenath

    Hi somenth,
    What is the difference between Idoc and RFC adapter ? How to decide which one will be used?
    A)in case of sender idoc means Sender IDOC adapter need not be configured because IDOC adapter
    lies in ABAP engine - IDOC adpter resides in Integration engine.
    Incase of receiver, whatever is the adapter, you need an adapter configuration and receiver
    agreement - from the IE, the xml msg need to be sent to pipeline of idoc adapter,
    so you need a recever agreement......
    IDOC #
    Idoc Adapter: The next most commonly used adapter is Idoc adapter for sending and receiving Idocs from SAP XI.
    The foremost step before configuring the idoc adapter is the system settings that have to be done
    Details:
    In the case where we encounter a standard IDOC provided by SAP or Situation where a mapping is available or
    an IDOC as well as a BAPI exits, the approach will be dependent on the specific integration scenarioo......
    for For example, options might be
    1) sending one IDOC at a time
    2) combing multiple IDOCS and sending as a single IDOC.
    3) making one single RFC call, for each business transation.
    4) avoiding multiple calls to the same BAPI / RFC by deploying a wrapper BAPI and sending all records in one call.
    5) Using the proxy and sending all data in one shot and making single calls to the BAPI from the proxy.
    proxy and rfc adapter #
    a proxy on the SAP application system should be used while interfacing with a standard BAPI or remote enabled
    function modules on the application system. the proxy will be invoked by SAP PI/XI and on the application system
    the proxy will call the BAPI. in SAP systems with WEB AS versions <6.20 the proxy option is not available and hence
    the RFC adapter should be used insted.
    Disadvantage:
    pre-built meta data and the mapping that SAP delivers will not be usefull as the BAPI is wrapped with a proxy.
    so if the pre-defined integration content is not taken into account the proxy should be used insted of configuring
    the RFC adapter and calling the BAPI / RFC
    Advantage:
    it bypasses the adapter engine and directly interacts with the application system and integration engine thereby
    enchancing the performance
    2 )What is the role of the container element in BPM?
    A)The workflow container contains an element which is defined with a data type reference to the same object type that is created in the referenced task, this binding definition is proposed automatically when an activity is defined.
    If no element with an appropriate data type reference is available in the workflow container, a suitable element is added to the workflow container and the binding entered.
    Defines the data for a business process and to enable data to be transferred between the individual steps of the business process.
    consists of an unlimited number of container elements.
    Container elements ( Variable declaration)
    Consists of a name to address data in the process
    Can be typed to
    *Simple XSD ypes :XSD:data,XSD:time,XSD:integer, XSD:string.
    *Abstract interface
    *Receiver
    *Can be multiline ( a vector of the types above)
    3)How to restart the adapter engine or J2ee engine?
      SMICM
    4)What is the role of wndows1 and windows2 in SXMB_MONI?
    Window1 and window2 will get you the message payload
    we can check the messages in SXMB_moni
    regards
    srinivas

  • PLEASE HELP!  I KNOW WHAT I NEED!

    Hello, all the past year I have been unable to download Flash Player direct
    from Adobe.com.
    A support tech sent me a executible download and had me install it myself
    and it worked for me all year.  Because I have this problem about once a month.
    Now, I can't install Flash Player because it comes up and says there's a newer
    version.
    I just spoke with support who was basically unhelpful.
    I KNOW WHAT I NEED!  I need a downloadable .exe Flash Player to install myself.
    That's the only thing that works on my computer!
    Please help!
    Thank you, Pennie

    Here you go....This is the offline, put on your desktop Uninstaller, followed by the offline, put on your desktop Installer of the new version 10.0.42.34.
    http://kb2.adobe.com/cps/141/tn_14157.html
    http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_ax .exe
    Happy New Year!

  • HT5313 why i cant update it ... always saying NO PERMISSION please help me dont know what to do wifi connect also is down and slow

    please help me since i update my os snow leopard to os lion its seem to be nice and operation is very well ... after a month its gives trouble i cant update it and cant watch video from youtube , cant attach any files wifi is up and down with my airport express? dont know what to do now ... please help me and advise pls

    Read here  >   iOS: Understanding the SIM PIN

  • SFE2000 CLI- does it exist??? Please help if you know!

    Is there a CLI, other than the terminal mode menu, for this switch?
    I would much prefer to use a CLI to configure it than the (web) menus available.
    The web menus are confusing and the manual is long. I already know how to configure Cisco Switches via the CLI quite well.
    Please help. Thanks you!

    Hello Mark,
    Thank you for participating in the Small Business support community. My name is Nico Muselle from Cisco Sofia SBSC.
    To access the CLI, go to the entry page of the menu based console, then press Ctrl+Z and type lcli. You will need to enter your login credentials again, after that you will arrive in the CLI.
    Please note that the CLI on the SxE switches, although much similar, is not exactly the same as Cisco IOS.
    Hope this was informative for you !
    Best regards,
    Nico Muselle
    Sr. Network Engineer - CCNA - CCNA Security

  • Please help if you know anything about Kontakt player 3.0.5, GPO & FCH?!

    Hi There. I am desperate for a solution as NI doesn't seem to be responding to my requests for help and support. Can anyone maybe offer any assistance?
    I installed Garritan Personal Orchestra & First Call Horns and then installed Kontakt Player 3.0.5 (Mac Pro 4-core 2.66Ghz, Mac OS X.5.8 ) and it finally picked up these instruments in Logic Pro 8.0.2.
    Soon after I started noticing that if I load a song up with some instances of the Kontakt player 3 (GPO and or FCH loads into Kontakt player 3) my sample banks come up as DEMO's, asking me to activate the product in-order for it to remove the 30 min time limit the demo mode imposes.
    It does this even though all my soft synths are activated and is clearly indicated so in the NI service centre program.
    Can anyone out there please help me or give me advice? I really need my soft synths that run inside Kontakt player 3 to STOP showing up as demo's.
    Also does anyone know why NI is not answering me? Are they in the habit of ignoring their clients?
    Thanks so much for any assistance given.

    No I have my own iPhone iPad and MacBook  so everything is set up on devices that are mine and as far as I know I never connected to anyone else's device and logged with my apple ID.  But are you saying it is possible for someone to have obtained my apple ID and send an iMessage from their device with my contact information so it looks like it came directly from me?  It's crazy I looked down at my iPhone and saw this message had just been sent that I did not type or send

  • Hello - does anyone now how to place a complain for an over charged invoice over a in-purchase game? Apple is charging 10 times more the purchase we made and I cannot find anyplace in the App store to complain online or via email? Please help if you know

    Hello - does anyone now how to place a complain for an over charged invoice over a in-purchase game? Apple is charging 10 times more the purchase we made and I cannot find anyplace in the App store to complain online or via email? Please help if you know

    Use the Report a Problem link in the iTunes email receipt you received. Also in-app purchases can be made without the password if you bought the app within the last 15min. You should enable the in-app restriction in Settings.

  • Got a new Samsung galaxy s3 and can't get messages from iphone users now. Don't have the old iphone to change the settings ! please help . need to know how I can get messages on my galaxy

    Can't get messages from iphone users on my new Samsung g allaxy and don't have my old iphone anymore ! Please help !

    Read here under no longer have device:
    http://support.apple.com/kb/ht5661
    Be aware, changing your Apple ID password doesn't always work, & can take up to 45 days to work.
    It's either that, or you call AppleCare & have them fix.

  • Hey i have pruchased my iphone 4s from singapore and right i m in india. i can't download any application. can you please help me to know to download application.

    hi sir
    please help me to download my application that is charable and free so that i can enjoy my iphone 4s 16GB.
    thanking you

    You need an iPhone forum not an iPhoto one.

  • Please help me to know the tables which contain details of APD and Open hub destination

    Hi experts,
    I need to know the list of APDs that have been created in our system. So can you please let me know the table name (if there is any) which contains the name of the APD and as well as the status (active / inactive) of the APD.
    Thanks ,
    Shalini

    Hi Shalini,
    Go to RSANWB  T-code and select any analysis process. Then press the "monitor" button. On the monitor screen, you can see the selection criteria in a table on the right. Now double-click on the table and a popup will come up where you can set the selection criteria. in particular, you can set the time frame and the analysis process selection.
    Hope it 'll help you..........
    Regards,
    Mukesh

  • Hi, please help if anybody know joins involving ap_checks_stocks_all and ap_check_formats with ap_invoice_selection_criteria

    I am supposed to do a R12 upgrade/implementation in 2 days for a report which has a query as below, though it looks simple, it seems complicated or maybe I think it is  :
    SELECT DECODE(aisc.status,
                      'BUILT','N',
                      'FORMATTING','N',
                      'QUICKCHECK','N',
                      'Y'),
               DECODE(aisc.status,
                      'QUICKCHECK','Y',
                      'N')
          FROM ap_invoice_selection_criteria aisc,
               ap_check_formats acf,
               ap_check_stocks acs,
           ap_bank_accounts ba,
           ap_bank_branches bb
         WHERE aisc.checkrun_name  = :P_PAYMENT_BATCH
           AND acs.check_stock_id  = aisc.check_stock_id
           AND acs.check_format_id = acf.check_format_id
           AND ba.bank_account_id = ACS.bank_account_id
           AND ba.bank_branch_id = bb.bank_branch_id;
    But what I also do not understand is what is the use of ap_check_stocks and ap_check_formats in the above query
    And also please let know if I can replace it with the following query or is it a totally wrong to do so and what shall miss out if i do so.
    SELECT DECODE(aisc.status,
                      'BUILT','N',
                      'FORMATTING','N',
                      'QUICKCHECK','N',
                      'Y'),
               DECODE(aisc.status,
                      'QUICKCHECK','Y',
                      'N')
          FROM ap_invoice_selection_criteria aisc,
                 apps.iby_ext_bank_accounts ba,
               apps.CE_BANK_BRANCHES_V bb
         WHERE aisc.checkrun_name  = :P_PAYMENT_BATCH
           AND ba.ext_bank_account_id = aisc.bank_account_id
           AND ba.branch_id = bb.branch_party_id;
    New to these queries too. Sorry if there is a silly point I m asking.
    Thanks a lot.

    Hi,
    as this issue is related to APPS better to post your query in the apps forum.
    Reference
    https://forums.oracle.com/forums/category.jspa?categoryID=3
    Regards, Roberto

  • I believe some how some way my iPhone or appleID has been hacked into.  My iPhone sent 3 iMessages out that I did not type or send - 2 while I was sleeping and one while I was in mid imessage conversation.  Please help if you know anything about this!

    I believe that my iPhone or apple ID has been hacked into.  Three imessages were sent from my phone that I did not type or send - two while I was asleep at 1:15am and in the morning during an iMessage conversation.  These messages were to my boyfriend about my boss.  Apple and AT&amp;T have been somewhat helpful but both are pointing fingers at the others saying they cannot track the message or see if my personal information has been compromised.  I feel extremely violated because this hacker knows who my boyfriend is and who my boss is and I just started this job two weeks ago!  I am about to go to the police because this person is trying to taint my good reputation and destroy my relationships at work and in my personal life.  Does anyone have any incite on how this could be done and is there any way to trace where those three iMessages were generated from??

    No I have my own iPhone iPad and MacBook  so everything is set up on devices that are mine and as far as I know I never connected to anyone else's device and logged with my apple ID.  But are you saying it is possible for someone to have obtained my apple ID and send an iMessage from their device with my contact information so it looks like it came directly from me?  It's crazy I looked down at my iPhone and saw this message had just been sent that I did not type or send

Maybe you are looking for