Question regarding Inheritance.Please HELP

A question regarding Inheritance
Look at the following code:
class Tree{}
class Pine extends Tree{}
class Oak extends Tree{}
public class Forest{
public static void main(String args[]){
  Tree tree = new Pine();
  if( tree instanceof Pine )
  System.out.println( "Pine" );
  if( tree instanceof Tree )
  System.out.println( "Tree" );
  if( tree instanceof Oak )
  System.out.println( "Oak" );
  else System.out.println( "Oops" );
}If I run this,I get the output of
Pine
Oak
Oops
My question is:
How can Tree be an instance of Pine.? Instead Pine is an instance of Tree isnt it?

The "instanceof" operator checks whether an object is an instance of a class. The object you have is an instance of the class Pine because you created it with "new Pine()," and "instanceof" only confirms this fact: "yes, it's a pine."
If you changed "new Pine()" to "new Tree()" or "new Oak()" you would get different output because then the object you create is not an instance of Pine anymore.
If you wonder about the variable type, it doesn't matter, you could have written "Object tree = new Pine()" and get the same result.

Similar Messages

  • Support ,​ ​ This is Thamer mohammad  ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .​ ​ Best wishes

    Support ,​
    This is Thamer mohammad
    ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .​
    Best wishes

    These boards aren't Apple Support; nobody here can reset the questions. Click here, phone Apple, and ask for the Account Security team, or fill out and submit this form.
    (90021)

  • I forgot my security questions can you please help me?

    i forgot my security question can you please help me?

    See Here > Apple ID: Contacting Apple for help with Apple ID account security
              Ask to speak with the Account Security Team...
    Or Email Here  >  Apple  Support  iTunes Store  Contact
    More Info >  Apple ID: All about Apple ID security questions
    Note:
    You can only set up and/or change a Rescue Email BEFORE you forget the questions/answers.

  • HT5312 Dear Apple Support ,  I can't remember my security question answers , so Please help me to Create new Security Question for my Account .  Best wishes

    Dear Apple Support , I can't remember my security question answers , so Please help me to Create new Security Question for my Account .  Best wishes
    <Email Edited by Host>

    Welcome to the user to User Technical Support Forum provided by Apple.
    Please do not post personal information on a Public Forum.
    I have requested the Hosts remove it for you
    For your issue...
    See Here > Apple ID: Contacting Apple for help with Apple ID account security
              Ask to speak with the Account Security Team...
    Or Email Here  >  Apple  Support  iTunes Store  Contact
    More Info >  Apple ID: All about Apple ID security questions
    Note:
    You can only set up and/or change a Rescue Email Before you forget the questions/answers.

  • Dear Apple Support ,  This is amany alnajjar ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .

    Dear Apple Support ,
    This is amany alnajjar ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .

    The Best Alternatives for Security Questions and Rescue Mail
        a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
        b. Call Apple Support in your country: Customer Service: Contact Apple support.
        c. Rescue email address and how to reset Apple ID security questions.

  • Dear Apple Support ,  This is FAHAD ALGORWAN ,I can't remember my security question answers , so Please help me to Create new Security Qu

    Dear Apple Support ,  This is FAHAD ALGORWAN ,I can't remember my security
    > question answers , so Please help me to Create new Security Qu

    Please do not make multiple posts. One is enough. These are user forums, so you are not speaking to Apple here.
    The Best Alternatives for Security Questions and Rescue Mail
        a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
        b. Call Apple Support in your country: Customer Service: Contact Apple support.
        c. Rescue email address and how to reset Apple ID security questions.

  • Dear Apple Support , This is ***Abdurrahman*** ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account . Best wishes,

    Dear Apple Support ,
    This is ***Abdurrahman*** ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .
    Best wishes,

    The people on these boards aren't Apple Support and can't do that for you. You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (102461)

  • I can't remember my security question answers , so Please help me to Create new Security Question for my Account .

    rt ,
    This is ***majed*** ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .
    Best wishes,

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then the steps half-way down this page give you a reset link on your account : http://support.apple.com/kb/HT5312
    If you don't have a rescue email address (you won't be able to add one until you can answer your questions) then you will need to contact iTunes Support / Apple in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down the HT5312 link above to add a rescue email address for potential future use

  • I can't remember my security question answers , so please help me to Create new Security Question for my Account : ********  , Best wishes

    I can't remember my security question answers , so please help me to Create new Security Question for my Account : **********
    , Best wishes
    <Personal Information Edited by Host>

    We are fellow users here on these user-to-user forums, you're not talking to iTunes Support nor Apple - I've asked the hosts to remove your email address from your post (it's not a good idea to post personal info on any public forum).
    If you have a rescue email address (which is not the same thing as an alternate email address) on your account then the steps half-way down this page will give you a reset link on your account : http://support.apple.com/kb/HT5312
    If you don't have a rescue email address (you won't be able to add one until you can answer your questions) then you will need to contact Support in your country to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699
    When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down the HT5312 link above to add a rescue email address for potential future use

  • HT5312 I forgot my Secret Question's answers please help me out!

    I forgot my secret Question's Answers I want to buy some app from Apple but it asks me my secret Questions answer that I forgot, please help me out!
    Thanks and Regards,
    emam

    Didn't the link to contact the iTunes Store staff in the 'Additional Information' section of that article work for you? If you don't already have a valid rescue email address, only Apple itself can assist with recovering lost answers.
    (88586)

  • Authorization question - Need Answers - Please help

    Hi,
    I have collected the following questions. Can you please answer? Thanks.
    1)     What is Authorization object
    a.     Collection of Authorization fields
    b.     Authorization fields fill with Values
    c.     Group of Authorization Key.
    d.     Authorization object fill with Values.
    2)     Which of the statement below accurately describe when S_RS_ADWMB  will be used.
    a.     when using transaction code RSA1, the administrator work bench
    b.     when creating new query in the Bex Analyser.
    c.     When updating source system in RSA1
    d.     None of the above.
    3)     which of the following objects protect ODS data.
    a.     S_RS_ODSO
    b.     S_RS_ODSP
    c.     S_RS_ODSS
    d.     S_RS_ODSA
    4)     When would you use the $ in an authorization value?
    a.     If you are using user exit to fill the authorization values at runtime.
    b.     If you have cost centres that starts with $
    c.     Anytime you want to grant all values: $ is just like * in the SAP R/3
    d.     If you want all variables to be filled with authorization values at runtime.
    5)     Hierarchies are used in SAP BW to rank Employees.
    a.     True
    b.     False
    6)     RFC destinations tell SAP systems where external systems are located.
    a.     True
    b.     False
    7)     Which are the following objects are used for infosource with flexible updating
    a.     S_RS_ISOUR
    b.     S_RS_ISRCM
    c.     S_RS_ISOCR
    d.     S_RS_ISCOM
    8)     Which of the following regarding Info area is correct
    a.     Group of Infocube.
    b.     Group of Infosource
    c.     Group of source system
    d.     Group of actual data.
    9)     Field S_RS_COMP can protect the query elements by infoarea,infocube and query name that user is trying to access.
    a.     True
    b.      False
    10 ) Authorization object S_RS_HIER is used when creating infocubes.
    a.     True
    b.     False
    11)If the info object is authorization relevant then it must have authorization object.
    c.     True
    d.     False
    12) What is composite role.
    a.     Includes number of roles
    b.     Single role including number of authorization keys\
    c.     Role within a role
    d.     None of the above.
    13) EP uses same role for portal access.
    a.     True
    b.     False
    14) You must include S_RFC in any role used by reporting user.
    a.     True
    b.      False
    15)     Same BW role can be used for another BW system using the same client.
    a.     True
    b.      False
    Advance Thanks,

    Can anyone please help me urgently?
    Advance Thanks.

  • IPhone 3g broken ,Genuis Bar Questions.  ****LONG**** PLEASE HELP

    Well i guess ill say the whole story. I bought my iPhone on August 6th and i had a plane to catch that day to Cali. So i synced it all up with my mac mini. My dad also got one and he went to Brazil (which is why im in Cali) While ive been here ive been syncing my iPhone with her windows computer to put apps on. Everything has been great until this week. Im calling it **** week. Ever since i updated to 2.0.2 its had no service most everywhere, apps and safari quit and when safari doesnt it runs extrememly slow and typing lag is worse then ever. I figured whatever maybe once i go back home it will start working again. Well thats not the case. Last night i was downloading apps and one of them got stuck when it was almost done installing. So synced it with my computer and it took it off.. well it still showed that it was installing. So i restarted my iPhone and it got stuck at the Apple logo(which is a common problem i know about the big thread also) so i restarted it and everytime it would go back to the Apple logo. I tried restoring it and everytime i plug it into my computer its makes my computer run extrememly slow and itunes wont come up. Then when i unplug it itunes pops up and everythings running normally. So after about 6 hours straight of trying to fix it, its now not turning on at all. Even when i plug it into a power outlet and computer. So basically i have a broken iPhone and its worthless. I have an appointment but im wondering if its even worth it.
    Genuis bar questions:
    1. Does the accoutn holder have to be present? Im on the account but not the account holder. My dad said to try.
    2. Will they try and hold my iphone? I cant leave it there because i have to leave that day.
    3. Would they just give me a new one? I would love that and not have to go through all this trouble
    Please help im stuck withotu a phone in the worst possible time.

    Jaden Hawk wrote:
    Genuis bar questions:
    1. Does the accoutn holder have to be present? Im on the account but not the account holder. My >dad said to try.
    No.
    2. Will they try and hold my iphone? I cant leave it there because i have to leave that day.
    No.
    3. Would they just give me a new one? I would love that and not have to go through all this trouble
    If there is a hardware problem with the iPhone they will replace it for you.
    You may want to update and restore the iPhone.
    http://docs.info.apple.com/article.html?artnum=305744
    Jason

  • Regarding workflow please help

    Hi,
    In my workflow i'am sending the workitem to approvers at various levels in the hierarchy based on the deadline.
    when the workitem is woth the 1st level of approvers and no action had been taken on it by the deadline time, it is getting disappeared from the 1st level approvers inbox and going to second leve; approvers inbox.
    But in case if the higher level does not exist, i'am sending a work item to the initiator denoting NO ACTION HAD BEEN TAKEN.
    At this stage the workitem is not getting disappeared from the inbox of the highest level approver.Is it the standard or SAP Workflow or is there any way that we can remove the work item from the users inbox.
    Please Help..............................
    Thanks & Regards,
    bala

    Maybe this can help you... Although I used it to stop workflows that were still running at a certain point in the logic.
    You can use function 'SWW_WI_ADMIN_CANCEL'  to cancel a workitem.
    If I am not mistaken, it should remove the item from the inbox.
    Just a piece of the code:
    * And now, the change:                                             
    * Get workitems of object                                          
      CALL FUNCTION 'SWI_WORKITEMS_OF_OBJECT_GET'                      
           EXPORTING                                                   
                objtype  = 'BUS2012'                                   
                objkey   = z_objkey                                    
           TABLES                                                      
                itemlist = zitemlist.                                                                               
    * If at this point WF ZWF_PO_REL (WS90200009) is still running, it 
    * should be cancelled! Because the release is fully completed.     
      LOOP AT zitemlist WHERE wi_stat   <> 'ERROR'     AND             
                              wi_stat   <> 'COMPLETED' AND             
                              wi_stat   <> 'CANCELLED' AND             
                              wi_chckwi IS initial     AND             
                              wi_rh_task = 'WS90200009'.               
        CALL FUNCTION 'SWW_WI_ADMIN_CANCEL'                            
             EXPORTING                                                 
                  wi_id = zitemlist-wi_id.                             
        IF sy-subrc <> 0.                                              
        ENDIF.                                                         
      ENDLOOP.                                                         

  • I've got nothing(gray screen, question mark folder) Please Help!

    This problem is on my girlfriend’s computer, about the same as mine, PB G4 800mhz 768mb RAM, 10.4.x
    I am a competent user and this one has me worried…
    Problem
    Last night she goes to the computer sends an IM checks her e mail, watch some tv, goes back to the computer to look something up on line and its frozen, I do not recall if the mouse was visible but I don’t think there was a beach ball. She asks me what to do I said just give it a few minutes maybe it will process through what ever it is and be back to normal. We both forget to take a look at it before bed.
    This morning computer is still frozen/non-responsive and the fans are running... Shut down by holding down the power key. I try to re-start by pressing power key, screen lights up with gray background wait wait then the folder icon comes up with the question mark in it. This gets me worried.
    What I have tried
    I have tried to get it into target disc mode with my powerbook(computer B), I start up computer A holding down the T key and the screen goes to that moving firewire icon but the hard drive does not show up on my computer B.
    I tried unplugging it, removing the battery and re setting the pram
    I tried to run the hard ware test CD, but when I hold C to boot to the CD it spins up the disc and the little hardware test folder is in the middle of the screen but then it does not load any further. I had to shut down holding the power button. Computer would not eject CD so I had to start up and use unix eject cd command, this worked.
    I tried target disc mode again.
    I tried just a plain start up again.
    I do not have the 10.4 CD at my house so I have not tried to start from that yet, but I can borrow one from grandparents this evening after work, but I am worried since it will not start from the hardware test CD that it will not start from the system CD.
    I believe I have computer A backed up from either last week or the week before( I thought about doing it this weekend but did not get to it  ), she is not backed up daily as I am. Though she said there is quite a bit of important work from this past week.
    I have no idea what to do next or what the source of the problem could be(software or hardware). I fear the worst, but hope that you can share an idea that will turn out for the best!
    Please help me fix this computer, I can play with it some when I go home for lunch and then I need to get it fixed if possible this evening because she needs some important class work and grad school applications from it!
    Jerome

    So is the next step to try and re-format the drive and then use super duper to copy the back up over to that drive and then run disc utility and disc warrior on it? Which specs should I select for the re format, do they have to be the same as what is on my back up drive?
    Yes, reformatting the drive is the next step. Use your Panther installer discs, choose Mac OS Extended format, and check the box to install OS 9 drivers, just in case. The "Verified" SMART status is somewhat less reliable than a "Failing" status would have been: "Failing" definitely means trouble was detected, but "Verified" could just mean nothing seemed to be wrong right at the moment when you happened to ask. So if there's any trouble reformatting the drive, replace it: you shouldn't entrust anything important to it. If all goes smoothly with the reformat, the drive probably really is OK.
    What you can do with your backup depends on how you created it. If the backup is a bootable clone made with Carbon Copy Cloner or SuperDuper, you can clone it back to the reformatted drive the same way you created it in the first place, then add the extra files that were created or modified after you made the backup. If you just Finder-copied the drive to another drive, the backup isn't bootable, and copying it back onto the reformatted drive won't make that one bootable either: OS X isn't Finder-copyable. In that case, I really shouldn't advise you on reconstructing the former contents of the drive from your backup — my only experience of backing up OS X disks is by cloning, which eliminates all the hassles of making sure user accounts, passwords, permissions, etc. are transferred correctly to the backup, and then transferred correctly back to the original disk in a restore. Nearly four years after my adoption of OS X, I confess I'm still far more mystified by many aspects of it than I ever was by the old-time Mac OS.
    Message was edited by: eww

  • Myfaces t:columns question...please help me...

    Hi guys,
    i've tried lots of solutions,but i think i've find right solution to solve my question.
    I have to create a datatable with a fixed number of columns and other dynamic columns.
    I've rendered it using t:columns of Myfaces and it works fine.
    It's a piece of jsp page
              <t:dataTable
        value="#{biosamplesTable.biosamples}"
        var="biosampleItem"
         binding="#{biosamplesTable.biosampleDataTable}"  >
        <h:column >
            <f:facet name="header">
                <h:outputText value="Organism" />
            </f:facet>
           <h:selectOneMenu value="#{biosampleItem.organism}">
                <f:selectItems value="#{getDropList.selectOrganism}"/>
           </h:selectOneMenu>
    etc..etc..   
            <t:columns value="#{biosamplesTable.columns}" var="col">
             <f:facet name="header">
                      <h:outputText value="Nuova" />
            </f:facet>
            <h:inputText value="#{biosampleItem.column}" />
        </t:columns>
         <h:column>
            <f:facet name="header">
                <h:outputText value="Actions" />
            </f:facet>
            <h:commandButton
            value="Invia dati biosample" actionListener="#{biosamplesTable.editBiosample}" id="editBiosample">
            </h:commandButton>
        </h:column>
    </t:dataTable>     
    </h:form>     
    }     My only question is:
    I'm able to retrieve the h:column values for each row,i do it in editBiosample method
    public void editBiosample(ActionEvent event) throws SQLException {
              setBiosampleItem((Biosample) getBiosampleDataTable().getRowData());
              try {
                   if (conn != null) {
                        Experiment exp = (Experiment) ViewUtils.eval("#{experiment}");
                        PreparedStatement pst3 = null;
                        pst3 = conn
                                  .prepareStatement("INSERT INTO  campione(id_,organismo,protocollotrattamento,metodoestrazione,tipoamplificazione,protocolloibridazione,protocollomarcatura)      VALUES(?,?,?,?,?,?,?)");
                        pst3.setInt(1, exp.getAutoKey());
                        pst3.setString(2, getBiosampleItem().getOrganism());
                        pst3.setString(3, getBiosampleItem().getTreatmentProtocol());
                        etc...
              pst3.executeUpdate();
              pst3.close();
              catch (Exception e) {
                   e.printStackTrace();
         }now i have to retrieve the h:columns values for each row,how can i do it?
    Please help me,i've started so but there is some error,each values is null!!
    For generating columns i've used..
    public List getColumns() throws Exception {
         if (load2 == 0) {
         for (int i = 0; i < 3; i++) {
              UIOutput input = new UIInput();
            ValueBinding myItem =
                FacesContext
                    .getCurrentInstance()
                        .getApplication()
                            .createValueBinding("#{biosampleItem[" + i + "]}");
            input.setValueBinding("value", myItem);
            UIColumn column = new UIColumn();
            column.getChildren().add(input);
              columns.add(column);
              load2=1;
         else this.columns=columns;
         // Reload after every request.
         return columns;
    }what's wrong?
    Please help me,i need to solve my problem...
    thanks in advance...
    Message was edited by:
    giubat
    Message was edited by:
    giubat

    Ok, you have more than one frame and when you make your dialog, it is only modal on one frame.
    Not sure how to make a workaround for that. That would proably require that when another frame got the focus, it should check if any of the frames has a modal dialog visible, and if that is the case, it should move the dialog to the front (dialog.toFront()).

Maybe you are looking for