Why does Java allow this?

Hello Folks
Today I saw the following code in an exam about Java programming:
interface I {
     public final static double var = 32.0;
class A implements I {
     double var = 15;
}How can Java allow such a construct? I overload a variable that is public, static and final and replace it with an instance variable that is protected. In my opinion the compiler should reject that, I mean it does it when I try the same with a method. Why is it allowed with variables?
Regards
Der Hinterwaeldler

The declaration of the variable var in class A does not override the declaration in the interface I, it only hides it.
Methods are different because methods can be overridden. Static and final methods are an exception, they can't be overridden so trying to do it is a compile time error.
See also http://java.sun.com/developer/TechTips/2000/tt1010.html#tip2

Similar Messages

  • Why does Java have such a large footprint?

    I've been curious about this topic for a while, but I haven't ever looked into this to any depth. I also posted this to stackoverflow but haven't gotten any solid responses so far:
    http://stackoverflow.com/questions/1107991/why-does-java-have-such-a-large-footprint
    Java - or at least Sun's Hotspot JVM - has long had a reputation for having a very large memory footprint. What exactly is it about the JVM that gives it this reputation? I'd be interested in a detailed breakdown: how much memory goes to the runtime? (The JIT? The GC/memory management? The classloader?) Anything related to "auxiliary" APIs like JNI/JVMTI? The standard libraries? (Which parts get how much?) Any other major components?
    I realize that this may not be straightforward to answer without a concrete application plus VM configuration, so just to narrow things down at least somewhat: I'm primarily interested in default/typical VM configurations, and in a baseline console "Hello world" app as well as any real-world desktop or server app. (I'm suspecting that a substantial part of the JVM's footprint is largely independent of the app itself, and it is in this part that I'd like to zoom in, ideally.)
    I have a couple of other closely related questions:
    Other similar technology, such as .NET/mono, don't exhibit nearly the same footprint. Why is this the case?
    I've read somewhere on the intarwebs that a large portion of the footprint is due simply to the size of the standard libraries. If this is the case, then why is so much of the standard libraries being loaded up front?
    Are there any efforts (JSRs, whatever) to tame the memory footprint? The closest thing I've come across is a project to reduce the on-disk footprint of the JVM [1] and to modularize the standard library [2].
    I'm sure that the footprint has varied over the past decade or so with every new version of Java. Are there any specific numbers/charts chronicling precisely how the JVM's footprint has changed?
    [1] http://blogs.sun.com/jtc/entry/reduced_footprint_java_se_bringing
    [2] http://blogs.sun.com/theplanetarium/entry/project_jigsaw_modularizing_jdk_7

    yangzhang wrote:
    I've been curious about this topic for a while, but I haven't ever looked into this to any depth. I also posted this to stackoverflow but haven't gotten any solid responses so far:
    http://stackoverflow.com/questions/1107991/why-does-java-have-such-a-large-footprint
    Java - or at least Sun's Hotspot JVM - has long had a reputation for having a very large memory footprint. What exactly is it about the JVM that gives it this reputation? I'd be interested in a detailed breakdown: how much memory goes to the runtime? (The JIT? The GC/memory management? The classloader?) Anything related to "auxiliary" APIs like JNI/JVMTI? The standard libraries? (Which parts get how much?) Any other major components?
    Presumably versus some other VM. I would suppose the fact that much of the VM is written in java has something to do with it.
    I realize that this may not be straightforward to answer without a concrete application plus VM configuration, so just to narrow things down at least somewhat: I'm primarily interested in default/typical VM configurations, and in a baseline console "Hello world" app as well as any real-world desktop or server app. (I'm suspecting that a substantial part of the JVM's footprint is largely independent of the app itself, and it is in this part that I'd like to zoom in, ideally.)
    I have a couple of other closely related questions:
    Other similar technology, such as .NET/mono, don't exhibit nearly the same footprint. Why is this the case?
    Not sure I agree with that. What size do you see with a .Net app that uses 3.0/3.5?
    I've read somewhere on the intarwebs that a large portion of the footprint is due simply to the size of the standard libraries. If this is the case, then why is so much of the standard libraries being loaded up front?
    Good question. There is a feature that allows multiple VMs to use the same memory footprint version of the loaded libraries. That is a new feature and it isn't clear to me if it covers the entire API. I do not know if that is dynamically built.

  • Why does apple allow apps in the App Store hijack your Internet when certain websites? Why doesn't apple remove their products from the App Store?.

    Why does apple allow apps in the App Store hijack your Internet when certain websites? Why doesn't apple remove their products from the App Store?.

    Apple saw it as their responsibility since the redirection took me to the App Store. They assisted me in stopping the redirection which is occurring on many peoples iPhones. It's a have java script problem that adking is using to get you to buy their games. The websites work normal and then all of the sudden the website is taken over by adking.com.  You can no longer use the website as it immediately takes you to the App Store without ever showing a popup to cancel the redirection. They were very helpful fixing the problem should others experiencing this specifically with adking.com.
    No need to get defensive. I'm not the only one experiencing the problem Apple said.

  • Why does Labview allow a cursor in a indicator?

    Hello,
        Why does Labview allow the user to position the cursor with the mouse inside a numeric indicator? Users think that just because they can put a cursor they should be able to type something and enter data. Is there a way to disable/stop the user from putting the cursor in a numeric indicator?
    Regards,
    Kaspar
    Solved!
    Go to Solution.

    Disabling the indicator satisfies your requirements, but this is funnier.  It would be even better if I calculated the position of the indicator and the "entry point" and just kept the mouse from entering, but I have a project to finish... 
    Message Edited by jcarmody on 03-27-2009 11:58 AM
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
    Attachments:
    move.png ‏4 KB
    test.vi ‏9 KB

  • Why does LabVIEW allow me to have 2 controls with same name

    Here's a general LabVIEW question:
    Why does LabVIEW allow me to have 2 controls with the same name in the same VI?  It seems like this only increases the chances of confusion.  Especially when someone is just looking at a block diagram (or documentation of a block diagram).
    No other programming language that I know of allows this.  I realize that uniqueness of name is not as critical in LabVIEW as it is in any text based language.  For example, in a text based language, if I had 2 variables called abc and I wrote a statement
    abc = 12;
    the compiler would not know which abc was being referred to.  In LabVIEW, if we had 2 controls called abc, the equivalent of doing an abc=12 is writing to a local variable (which is always linked to one of the controls) and there is no ambiguity.  Still, someone looking at the code cannot figure out which abc is linked to unless he does a right click>>Find>>terminal (or a double click).
    Even though I have never and never will name 2 controls the same, I think it would be a nice constraint to see enforced by LabVIEW.
    Any input from NI engineers on this?
    Message Edited by S G on 12-18-2007 03:38 PM
    S G
    Certified LabVIEW Architect, Certified TestStand Developer, Certified Professional Instructor
    Attachments:
    Trial1.JPG ‏21 KB

    I know when you copy and paste a control or indicator, LabVIEW automatically increments the label. But since you can hide the label, and show or hide the caption, there must be another mechanism that LabVIEW uses to keep track of all the controls. I thought I remember back in the "old days" (ver 6 or 6i) LabVIEW would give you an error if you tried to make two controls with the same name. Perhaps that was LabWindows/CVI.
    I don't know where the index is actually stored, but if you look at a property node linked to the Pane, you will see an array of references to the controls and indicators. Since the references are stored in an array, I assume that any local variables are tied to the index of that array. Since the labels themselves are properties of the control, I guess there's no reason to limit what that label is. They all have a unique index number.
    Interestingly, this array of references grows from the beginning. That is, any new control or indicator is put at index 0, not the end of the array.
    B-)
    Message Edited by LabViewGuruWannabe on 12-18-2007 08:45 PM
    Attachments:
    Labels.png ‏12 KB

  • HT3728 Base station error, air port utility was unable to find my airport device. Why does it say this when it recognizes my airport on the computer? Yellow light has been on

    Base station error, air port utility was unable to find my airport device. Why does it say this when it recognizes my airport on the computer? Yellow light has been on

    On the older version of the AE you can still use older airport utility.
    But once you load the new one you cannot easily go back.. you can load an older 5.6 version though.. instructions below.
    For 6.3 you need to run ipv6 local link.
    see http://support.apple.com/kb/TS4597
    How to load 5.6 into ML.
    1. Download 5.6 for Lion.
    http://support.apple.com/kb/DL1482
    Click to open the dmg but do not attempt to install the pkg.. it won't work anyway.
    Leave the package open on the desktop so you can see the file. AirportUtility56.pkg
    2. Download and install unpkg.
    http://www.timdoug.com/unpkg/
    Run unpkg on the desktop.. If your Mac refuses to run the software, because it wasn’t downloaded from the Apple store, go to security in preferences and allow other software to work.. this is limitation of trade methinks. You can set back later if you like.
    Now drag the AirPortUtility56.pkg file over to unpkg.. and it will create a new directory of the same name on the desktop.. in finder, open the new directory, drill down.. applications, utilities .. there lo and behold is Airport utility 5.6 .. drag it to your main utilities directory or just run it from current location.
    You cannot uninstall version 6 (now 6.3 if you updated) so don't try.. and you cannot or should not run them both at the same time.. although I have had no problems when doing so.

  • When I get an alert from my car sat nav the music on my iphone has a long delay before it comes back on and misses a part of the track why does it do this.

    When I get an alert from my car sat nav the music on my iphone has a long delay before it comes back on and misses a part of the track why does it do this.
    It only seems to do this since an iphone download last year.......its driving me mad !

    See:
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities
    To copy iTunes purchases to the computer you have to log into (authorize) the account that purchased them and them transfer
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    When associating a device with an Apple ID see the following regarding the 90 day limit.

  • When I sync my ipod to add new material, sometimes itunes will automatically rearrange the song order of my pre-existing albums by number of plays. Why does it do this? And is there a way to stop it?

    When I add an album to itunes and subsequently to my ipod, everything is arranged by track number of the album. Sometimes when I sync in order to add new material to my ipod, itunes for some reason automatically rearranges some of my pre-existing material by songs with the greatest number of plays to least (though sometimes it seems to be completely random). When I check itunes on my computer, everything still appears to be in order but the way it appears on the device often is in the previously mentioned disorder. Why does it do this? Is there any setting that I can adjust to make it stop because the only way I've found so far is to delete the rearranged material and re-import the cd and then re-sync. It might sound picky, but I prefer that my music be in order by track number as the artists themselves intended for various reasons the foremost being that I often listen to whole albums from start to finish and this glitch makes such problematic. I have found some settings in preferences that focus on how material is arranged but this seemed to be focused on the actual folders where the music is located on my hard drive and not the way it appears on the ipod. If anyone knows the reason it does this or has suggestions on fixing it, I would be greatly appreciative. Thanks.

    Did the original songs that do not appear on the car player play in the Music app on the iPod? Sometimes glitches happen and they do not. Also, If y ohave a 5G iPod/iOS 7, purchase songs  will show with an cloud icon by them if they are not downloaded if Shall All is turned on in Settings>iTunes and App Store

  • ITunes says I have authorized five computers so I can no longer play music I have purchased. I have not replaced my computer once. Why does iTunes say this?

    iTunes says I have authorized five computers so I can no longer play music I have purchased. I have not replaced my computer once. Why does iTunes say this?

    Hey Christownsend,
    Thanks for the question. To troubleshoot this issue, you may want to try deauthorizing all computers:
    iTunes Store: About authorization and deauthorization
    http://support.apple.com/kb/HT1420
    To deauthorize all computers associated with your Apple ID
    If you need to authorize your new computer and are unable due to already having five authorized computers, you can deauthorize all computers by doing the following:
    1. Click iTunes Store on the left side of iTunes.
    2. If you're not signed in to the store, click the Account button, then enter your account name and password.
    3. Click the Account button again (your Apple ID appears on the button), enter your password, and then click View Account.
    4. In the Account Information window, click Deauthorize All.
    Note: You may only use this feature once per year. The Deauthorize All button will not appear if you have fewer than two authorized computers. If you need assistance on using this feature, please contact iTunes Store support via email (http://www.apple.com/support/itunes/store/).
    Thanks,
    Matt M.

  • Why does Java Application not working with Macromedia Flash 5 or MX?

    Why does Java Application not working with Macromedia Flash 5 or MX?

    Who says they don't?
    Although I don't know much about those I'd think they should be able to talk to Java Aps using Sockets or request Servlets ...
    Spieler

  • All I want is all my contacts on my phone and the same on my iMac, but no, that's too much to ask, instead I get everything doubled up on the phone and everything doubled up (triple in some cases) on the iMac, why does it do this? and more importantly how

    All I want is all my contacts on my phone and the same on my iMac, but no, that's too much to ask, instead I get everything doubled up on the phone and everything doubled up (triple in some cases) on the iMac, why does it do this? and more importantly how can I stop it? Thanks

    Look under system preferences on the mac at what is be controlled?  Look at Mail, Contacts, Calendars.  How many accounts are managing contacts?  Just the cloud? the cloud and gmail? or cloud, gmail, yahoo, and exchange?  If you have more than one contact account, then you will have different contact lists, if John Smith shows up in more than one of your contact lists, you will have multiple entries.
    Pick a contact list that is your master, (I use iCloud), only turn on contact syncing for it.  The same for your phone.  Spend some time on the iCloud webset (www.icloud.com) and work on your contact list there.  Clean it up, remove duplicates, etc...Changes will auto sync back to all your devices.  Life gets much simplier.
    Just remember, if you sync different contacts lists and a large number of people appear in your different lists, then they will appear as duplicates.

  • Weird Behavior. Why does Safari do this?

    Please, can someone explain to me why Safari (1.3.2) hops tabs? I click a link in one tab and instead of going forward to that link, replacing this tab's contents, it jumps (not all the time but usually) to a different open tab and replaces what was there. Unless I hold the command key before clicking a link. WHY does it do this?
    Any help will be greatlt appreciated. I'm about to move on to Firefox because of this weird behavior.

    So I figured I would switch to flickr for photos.
    Safari won't even upload in Safari!!!!
    I Choose the photo. And that's it. Safari will not go to the next step in flickr either.
    Both photobucket and flickr work and upload photos fine using FIREFOX.
    God I'm just so tired of Apple stuff not working.

  • Why does Firefox give this message when I do not have another program running "Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system."

    Question
    why does Firefox give this message when I do not have another program running or another window open - "Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system." edit

    See also "Hang at exit":
    *http://kb.mozillazine.org/Firefox_hangs
    *https://support.mozilla.com/kb/Firefox+hangs

  • Why does Illustrator open this file incorrect (coloured polygon becomes uncoloured)

    I have an eps file that opens incorrect in Illustrator (CS6, CS4, 10 I tested). I wonder why this happens. The path seems to be complex, but Photoshop and Distiller converts/opens this file correct. So this seems to be a bug in Illustrator. I ca send you the file.
    How can this be solved?
    Patrick.

    Please explain me where I can put my file? Can I email it to you? Can I upload this to this forum?
    Patrick.
    Date: Wed, 18 Dec 2013 08:24:05 -0800
    From: [email protected]
    To: [email protected]
    Subject: Why does Illustrator open this file incorrect (coloured polygon becomes uncoloured)
        Re: Why does Illustrator open this file incorrect (coloured polygon becomes uncoloured)
        created by tonyharmer in Illustrator - View the full discussion
    Hi Patrick
    Pop a link to the file up and let's have a look.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5941529#5941529
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5941529#5941529
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5941529#5941529. In the Actions box on the right, click the Stop Email Notifications link.
               Start a new discussion in Illustrator at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • Why does phone say "this device not supported" when charging

    why does phone say "this device not supported" when charging?

    If it is clean connect a 2nd accessory of the same kind to see if you need to replace the accessory or continue troubleshooting the phone.

Maybe you are looking for

  • Is not equal to operator not working properly in obiee 11g

    Hi , I have 5 members in a dimesion ENTITY.gen5 (A,B,C,D,E) . nOW , I am using a *"is equal to "* operator in that , ENTITY.gen5 = A;B . Which results in a strange error while running the report : Socket communication error : was attempted on somthin

  • Broken networking ?

    Hello, I have been using Arch on my laptop since Januray with no major problem. Till sunday still it was all good, but I have moved in a new flat with a cable modem I can't use with Arch it seems... It's plugged on the same ethernet NIC I was using b

  • JDBC Sender Conversion error

    Hi My Scenario is JDBC Sender-> XI ->IDOC. I have written a following select querry and update but I am getting and error from sender... select *  from bi5filmm.bsimhp UPDATE  HMPRCFG SET  VALUE =  'P' from  bi5filmm.bsimhp Error during conversion of

  • How do i separate emails from the same person

    I do not want emails back and to the same person archived into one. Is there a way to separate them?

  • MSS PCR form

    Hi gurus, I am having problem with custom made PCR forms in MSS.We added fields for the PCR in MSS and implemented the BADI QISR1 to bring the values to the form.But when the user clicked on the review button the custom fields are not returning the d