What you call this

If i have 2 seprate classes in two different packages
package in;
public class Animal {
public Animal() {
//accessible only throw inhertance or throw the dot operator if the accessing class is in the same package
protected void eat()
System.out.println("animal");
package out;
public class Horse extends in.Animal {
public Horse() {
* Override the protected method eat
protected void eat()
System.out.println("horse");
package in;
import out.Horse;
public class BarnHorse
public BarnHorse()
Animal a=new Horse();
//calling polymorphiclly the eat method in the horse class
a.eat();
the code compiles fine and calles the Horse version of eat and outputs "horse" although the calling class shouldn't know anything about the Horse eat version.

SunFred wrote:
GONO wrote:
the eat() in the horse class is protected this means that only classes inside the package or classes that inherits the horse class could access this methodWrong. protected means only the class itself and subclasses. "Classes inside the package" is the default access modifier.No, he was right.
Protected is the declaring class, subclasses of the declaring class, and classes in the same package as the declaring class. Else the code woudn't have compiled.
[JLS 6.6.1 Determining Accessibility|http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6.1]:
Otherwise, if the member or constructor is declared protected, then access is permitted only when one of the following is true:
Access to the member or constructor occurs from within the package containing the class in which the protected member or constructor is declared.
Access is correct as described in �6.6.2.

Similar Messages

  • What do you call this basic technique?

    Request: Is there a name for the technique I'm using below, because I
    know I've seen it and done it before.
    Context: I'd like to allow the user to resize images, while preserving
    their width:height aspect ratio. My GUI has a pair of JSpinners, for width
    and height, and when one is adjusted, the other should change.
    Example: if the aspect ratio is 2:1, setting the width spinner to 201
    should cause the height spinner to change to 100 (I truncate), whilst setting
    the height spinner to 100 should cause the width spinner to change to 200.
    But: I don't want those reactions to cascade: from the example, if the
    user sets the width spinner to 201, the height spinner should change to 100,
    but that is where it should stop -- the width spinner shouldn't itself react
    and change to 200.
    My solution: I'm a fan of fixing it in the model, and here is my tweak for
    SpinnerNumberModel: public class SafeSpinnerNumberModel extends SpinnerNumberModel {
         public SafeSpinnerNumberModel(int value, int minimum, int maximum, int stepSize) {
             super(value, minimum, maximum, stepSize);
         public void setValue(Object value) {
             if (!inSetValue) {
                 inSetValue = true;
                 super.setValue(value);
                 inSetValue = false;
         private boolean inSetValue;
    In my code, there are two JSpinners (with SafeSpinnerNumberModels),
    and each model has a ChangeListener that reacts by adjusting the other model.
    The flag stops the potential feedback loop.
    So, again, what would you call this technique?
    Thanks,
    BDLH

    Me too. And they love all those visual little
    thingies so much: ooh, when
    the number is positive it's displayed in black,
    otherwise it's red. I'm a
    genius! No lemme put 90 percent profit in here, just
    for the "what-if"
    question part. Yay! It's black!You should see some of the spreadhseets we have here. Risk management, process compliance, earned value management... I have no idea what any of this is, but its all thousands of rows of red-green-yellow, telling who's not doing any work. And if you change one value all the colors change all over the place. I bet they have Tetris encoded in there.
    I attempted to finish my bookkeeping for Q3 last
    Sunday but I was
    distracted by myself attempting to do the Towers of
    Hanoi puzzle
    using Excel. I managed to make it work, but it was so
    awful (using
    additional cells etc) I deleted it all. I still have
    to finish up Q3 ...Hmm, I believe I'll start short-selling JosAH Industries ;-)

  • What do you call this?

    Hi, I'm very junior in programming and I want to build my
    resume from what I learn everyday at work. Today I learned how to
    write an application using CF without any interface. What my app.
    does is to read a text file, my boss calls this file a feed file.
    Then I put the records into a tables in a DB and then I need to use
    these tables to
    create the rest of the logic. After I'm done with it I need
    to set up my app. to pick up this feed every day once a day in
    certain location. So I also learned how to set up a schedule Task
    from CF administrator.
    Now, i want to write this experience in my resume, what am i
    supposed to say? can anyone help please? Thank you
    guyzzz....

    Coldfusion scheduled job

  • What you call a robust method?

    in my project X, i am writing a method whose parameter should not be null, like the following:
    public class MyClass {
      public void myMethod(MyObject obj) {
        if (obj!=null) {
          // do something.
        return;
    }In order to make my method robust, i have several choices, but i dont know which coding style is the best.
    1, do not check obj, and if it is null, NullPointerException will be thrown out automatically when i use the null object.
    2, check the obj and throw out a runtime exception (NullPointerException or IllegalArgumentException) myself, like this:
    public void myMethod(MyObject obj) {
      if (obj==null) {
        throw new NullPointerException("MyObject cannot be null.");
      // do something...
      return;
    }3, check the obj and throw out a self-defined exception, like this:
    public void myMethod(MyObject obj)
    throws MyException {
      if (obj==null) {
        throw new MyException("MyObject cannot be null.");
      // do something...
      return;
    }At my point of view, the first one cares nothing about the legality of its parameter, and thus is not robust enough. The second one is silly because i have to add the same code at the beginning of all my methods. The third one is even sillier because i have not only to add the same code at the beginning of all my methods, but also to catch exception everytime i call them...
    So...who can give me some advices?
    thanks.

    This is not a problem to do with robustness, this is a reliabilityproblem.
    Reliability means that the operation behaves in a predictable manner regardless of the environment.
    Robustness means being able to act in a predictable manner regardless of the circumstances without causing unexpected exceptional conditions.
    If you leave out the null reference check your method will act reliably in that a NullPointerException will be thrown at the point where the instance is referenced.
    To make your method robust you have to be active in what you do, in this case throwing a NullPointerException as a result of the check for null makes sense as you control the message in the exception rather than relying on the default one.
    Throwning an IllegalArgumentException is not the correct thing to do. The problem here is that there is no argument passed here rather null (no value). If you do further checks in the method for legal values and then your method considers the value passed to be outside of constrainst then throwing IllegalArgumentException is the correct thing to do.
    Creating your own class of Exception or RuntimeException for this purpose is a decision you have to make for yourself. If the argument checks are supposed to be rigorous then checked exceptions (subclasses of the Exception class) should be used to force callers of your method to handle the potentional exceptional condition. In this case it makes sense to create and use your own Exception class. If they are not rigorous then NullPointerException and IllegalArgumentException are probably sufficient.
    You should look at the Tutorials here for help on how the JavaBeans framework for property change support works as well, it provides some helpful insights into this problem.

  • I was so excited about apple pay and now setting it up hoping to replace a wallet within next year or so and then boom 8 cards you are done! Come on Apple 8 cards is that what you call wallet replacement?

    I was so excited about apple pay and now setting it up and boom 8 cards and you are done is that the wallet replacement they thought they'll do? really? I mean most people have 10-15 cards at least and I am, well because of my side business I have lots so 8 is nothing to me!

    Not sure what you are saying.  I was able to very quickly set up my AmEx card - no problems at all.  For my PNC and Macy's cards, companies still working on being ApplePay-ready. 
    It will happen, just not as fast as we might like, but I think it is going to be fabulous. 

  • - What do you call this thing? -

    What is the common terminology for news article type
    templates/scripts like
    the one used by
    http://www.roadrun.com/blabbermouth.net/
    where users create
    accounts, read news articles, and comment on them?
    I know the talkbacks are referred to as talkbacks, but I'm
    referring to the
    entire driving engine... what is this thing powered by?
    What's that called,
    so I know what to search for?
    Thanks.

    Wiki?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "R. Jay" <[email protected]> wrote in message
    news:eoot5a$5kl$[email protected]..
    > What is the common terminology for news article type
    templates/scripts
    > like the one used by
    http://www.roadrun.com/blabbermouth.net/
    where users
    > create accounts, read news articles, and comment on
    them?
    >
    > I know the talkbacks are referred to as talkbacks, but
    I'm referring to
    > the entire driving engine... what is this thing powered
    by? What's that
    > called, so I know what to search for?
    >
    > Thanks.
    >

  • (OT) What would you call this section of a Graphic Portfolio website?

    On my graphic design portfolio website, there will be a Portfolio section where you'll see finished items like posters and flyers.
    But I'll also add a section containing various airbrushing/photoshopping jobs. This section will hold before/after images... like 1) A picture of a person, 2) A picture of a cave, and 3) The photoshopped picture of the person inside the cave, with arrows to indicate that the first two pictures were merged. The section will also contain traditional airbrushing (before/after model shots).
    I am reluctant to call it just "Airbrushing" because there's a lot more intricate work than that. Taking a person or object out of one environment and placing them in another is referred to as "Photoshopping" nowadays... but I'd like to use an expression that isn't specific to this program, if at all possible. What would be a more appropriate name for such a section?
    I thought of "Photo Editing". Would that work? Or does that make you think of something else entirely?

    Well, I was being serious.  You didn't list the size limitation initially.
    How about "Work Samples", "See My Work", "Some of My Work".
    -Noel

  • Do NOT "update" to Anna!! You call this an UPDATE?...

    I knew I shouldn't have done it. Anyway, I got the **bleep**. Ehm... I mean, Anna.
    Here's what I got:
    - it took me ages to figure WHY my N8 was now connecting to the web using the mobile network. Turned out if it was now set to the G3 system, and for some reason it just doesn't CARE that you set it to use strictly your home wireless. So, I can only use GSM.
    - Out on the street, just NO WAY to browse using the mobile network, viceversa. Well, cool, it will help saving some money, I guess.
    - New themes and keyboard to enter messages. Nokia, what kind of beings do you employ in R&D, rats???!! Have you EVER seen a HUMAN being? I have NORMAL fingers, and I can tell you there is NO WAY I can use these **bleep**ing keys you and Anna have conceived.
    That's for the last 24 hours, will keep you UPDATEd with new findings. 

    I am having very bad experiece other than the keyboard and  features which they call it as added advantages....My problem after the upgrade are below:
    1. My N8 battery which used to last for minimum 2 to 3 days (for my normal usage - voice call, little GPRS browsing), after the upgrade it lasting only for 8 to 12 hours. When I installed battery monitor utility it says some Backgroud application is utilizing all my battery power.
    2. Phone is restarting by itself when not in use or when any call is landing.
    3. I tried formatting it couple of times using *#7370#  and 3 button reset and ended up more problem of losing internet not getting connected with error network connection rejected.
    4. I am using Nokia phone for past 8 years (Nokia 7610, N73Music edition) and I bought this N8 last year. I never had such a bad experience with any models. I am planning to scrap it and go for iPhone3GS which is now almost the same cost as N8 in chennai now.
    If I had referred to the forum prior to my update I wouldnt have done upgraded it. This is the first biggest mistake I did in my life.
    Is any Nokia R&D tech is reading this? Could you please give me any ERT for this issue fix else we will all come and literally throw the nokia handset and move to other products...
    Need a reply urgent...

  • TS4268 Only way to fix problems caused by update is to erase all content from phone?  You call this a fix????

    Please help me rool back after this distater called and update iOS 7.0.2

    I can sign into all my Apple apps EXCEPT Facetime.  It refuses to activate and says I have no network connection.  I used this all the time on the old OS.  I am not the ony one having this problem if you check the forums.  I am not resetting the wifi on all my other systems to accomodate my phone, nor should I have to.  I should not have to lose all my data and information and reset my phone.  I want this to activate.  I am not the only one.

  • You call this Nokia Support?????

    Having problem with proximity and brightness sensors-not working after updating with cyan. Can anybody help? Stop offering me the nokia recovery tool.it does nothing.after using the tool or hard reset sensors working for an hour and just stop. I want my sensors working back. Microsoft should read feedback and make a bigfix just like Apple do in a week.or should get the chance to downgrade to any older windows phone. If i get the newest PC with windows 8 i can install ot in win xp. It has no updates anymore i know it but the choise which OS to use is mine... Its the same with the windows phone. I dont't like cyan and want to use lumia black. So give me something about my problems to make me continue using windows phone at all...

    My phone is NOT broken.many users have the same problem...you can read! I want an option to downgrade to lumia black.it is my right... With what exactly the cyan is better? One action center and background image...ooo i forget-many bugs-sensors,ringtones,camera , etc. I want the old software. Az i windows user i paid for my phone to use all the feautures it has,right? So i do not deserve to wait a bugfix to use my phone as normal. With all the advertises and promotions of cyan microsoft could worked harder to make the perfect OS like they said...there is gotta be an option for downgrading. Again-the choice is ours which software we are gonna use

  • Photoshop help: I don't know what to call this (screenshot)

    Hi there,
    I primarily use photoshop to paint, and today had a very odd thing happen which I do not understand in the least.
    I was working on a piece, back ground later unchanged, medium grey on top of that, and a third layer set to multiply where I was drawing in black and white.
    I must have hit some funny keys, because, after I use the lasso tool to select part of the drawing on the third layer (multiply) what happened was that the grey background layer moved. When I moved it there was an off light red colour underneath.
    Screenshot: http://s111.photobucket.com/albums/n146/Chax424/?action=view&current=Screenshot2010-07-21a t44738PM.png
    (NOTE: For the screenshot I turned off the grey layer, instead a would be white background is moving. I have no idea where it or the red colour came from.)
    Another odd thing was that it seemed as though there was some sort of mask-esque situation going on, when I selected the colour black and tried to paint it cut into the white layer.
    Screenshot: http://s111.photobucket.com/albums/n146/Chax424/?action=view&current=Screenshot2010-07-21a t44752PM.png
    The opposite happened with the colour white.
    Screenshot:http://s111.photobucket.com/albums/n146/Chax424/?action=view&current=Screenshot2010-07-21a t44746PM.png
    Please, any help would be appreciated. I cannot selected anything and therefore cannot save the line sketch I mate. Granted it only took 7 to 10 min, but I would like to save it and, well, finish it.
    Thank you,
    Cheers

    http://www.google.com/search?hl=en&client=safari&rls=en&&sa=X&ei=PYBHTLa_A4PknAfmnoHVBA&ve d=0CBQQBSgA&q=Photoshop+quick+mask&spell=1

  • Why are you calling this the most customizable version when you've taken away customization options?

    I used to be able to move the back, forward, refresh, and stop (and make them separate buttons as well). With this version, they're immovable, and you're some how saying this is more customizable.

    For the first time, starting in Firefox 29, the menu is customizable, and there is a right-click option to easily move items between the menu and the main navigation toolbar. But you are correct that some previously detachable parts of the address bar are no longer detachable, and the tab bar can't be moved below the navigation toolbar through the customize feature.
    I don't know how to score that mix of gains and losses, but really, this support forum is aimed at making the current release of Firefox work for you. Did you find a solution, such as the [https://addons.mozilla.org/firefox/addon/classicthemerestorer/ Classic Theme Restorer extension], or are you still in search of one?

  • Seriously, you call this matching?

    Honestly, i like iTunes Match and the whole idea behind it. And I can see that something like that is a complicated matter. But today I came to the point that matching did not even match its own songs: I've downloaded a few songs, that have been matched, in better quality. Since I give my tags a personal flavor (like I put the release year before the album name), so I've deleted the songs from the library, spiced up the tags and put the same songs back into the library. End of story: 9 songs have been matched, 1 song was uploaded. Seriously, that was a song from the store with one tiny tag change. You've got to be kidding me.

    I've been able to replicate this, just now -- tried a few hundred random iTM'd AAC's and four of them ended up as uploads.  I checked the timestamps and they were all in November (iTunes 10.5.1), so I thought that maybe it was due to the newer version of iTunes.
    But then I did a second test -- this time with a few hundred songs I've done just in the last two days.  And sure enough, one of them was uploaded. I then deleted and tried my original file, and that one still matched!   I actually tried this on two different systems with the exact same results.
    I can't really explain this, since I don't know how the Match process works.  But I always figured that it used the actual song in the database as its waveform footprint.  But now I'm not so sure of that given that I have matched tracks that I cannot rematch - perhaps the waveform analysis is coming from somewhere else?
    I'll poke around some more and if I find an example on a song that's fairly common, I'll post it here.   That way perhaps someone else can confirm the same, if they have the same song.

  • I have just installed Firefox 4. I went to a bookmarks folder and wanted to go a particular bookmark in the folder. The bookmarks appear to the left now but the arrow points to the right. You call this an improvement?

    The question is written above. Please answer it and if this is the new way lists are going to appear, I'd rather go back to the old Firefox

    The question is written above. Please answer it and if this is the new way lists are going to appear, I'd rather go back to the old Firefox

  • But in ipad page there is no ipad 3 and ipad 4 ithink that ipad3 is that wahat you call the ipad 2 and the ipad 4 is the ipad 3 right

    but in ipad page there is no ipad 3 and ipad 4 ithink that ipad3 is that what you call the ipad 2 and the ipad 4 is the ipad 3 right

    iPad 3 vs iPad 4
    http://www.digitaltrends.com/mobile/ipad-3-vs-ipad-4/

Maybe you are looking for

  • Can i sync both my sons ipod touches to my itunes account

    can i sync both my sons ipod touches to my itunes account

  • Total Credit Limit for Co. code

    Hi sappers,                   I want to fix a total credit limit for Co. code sothat the aggregate of credit limit fixed for every Customer cannot exceed that total credit limit.

  • Sad Pagemaker Files

    I have some old pagemaker 5.0 files from an OS 9.0 machine that I'm trying to open in pagemaker 7.0 on a windows xp machine. When I try opening them on the windows platform it says that I can't convert to pc and upgrade at the same time. I tried to o

  • Eepc 901 Archlinux with Kdemon and kdm Login Manager

    Hello, 1.) I have a minimal defect or cosmetic effect on the kdm login system. When I start kdm, I get on left and on the right side of the screen a nasty bar. Nasty Bar means it looks like a piece of the background with nasty colours.....(left side.

  • Assitance with Script

    Here's my situation: We are presently printing our photographs for court using PowerPoint using the Handout page with two images per page.  The problem is the images are small and the Noritsu printer is capable of printing PowerPoint presentations us