Using the word super to access superclass fields - How?

I just read that it is possible to access public members of the superclass by using the keyword super. To test it, I tried the following but it does not work. What is the proper way?
public class A {
     public String color = "Black";     
public class B extends A{
     public String color = "White";
public class test {
     public static void main(String[] args) {
          A x= new A();
          B y= new B();
          System.out.println(x.color); //returns Black
          System.out.println(y.color); //returns White
          System.out.println(y.super.color); ERROR!!!
}

Just trying to make this readable
package forums;
class Superclass {
  public String name = "Superclass";
class Subclass extends Superclass {
  public String name = "Subclass";
public class TheSuperSubClassTesterator {
  public static void main(String[] args) {
    Superclass superclass = new Superclass();
    System.out.println(superclass.name); //returns Superclass
    Subclass subclass = new Subclass();
    System.out.println(subclass.name);  //returns Subclass
    System.out.println(subclass.super.name); //ERROR!!!
compile
---------- build ----------
C:\Java\home\src\krc\tools>"C:\Program Files\Java\jdk1.6.0_12\bin\javac.exe" -Xlint -d C:\Java\home\classes -cp c:\java\home\src;.;C:\Java\home\classes C:\Java\home\src\krc\tools\TheSuperSubClassTesterator.java
C:\Java\home\src\krc\tools\TheSuperSubClassTesterator.java:20: cannot find symbol
symbol  : class subclass
location: class forums.TheSuperSubClassTesterator
    System.out.println(subclass.super.name); //ERROR!!!
                       ^
1 error
Output completed (1 sec consumed)

Similar Messages

  • Can songs uploaded using the iMatch service be accessed by other family members using the Family Sharing feature?

    Can songs uploaded using the iMatch service be accessed by other family members using the Family Sharing feature?

    No
    Which purchased content can I share using Family Sharing - Apple Support

  • Using the word "iPhone" and the Apple Logo

    Hello Forum,
    If creating marketing collateral as a leave behind for potential clients to an industry specific iPhone App, would it be OK to use the words "iPhone" & "Apple" in addition to an image of the iPhone and the Apple Logo on printed materials. I browsed the Apple Website for a long time and could not find any information about this request... any help would be very much appreciated.
    Thanks,
    Paul

    I browsed the Apple Website for a long time and could not find any information about this request...
    https://developer.apple.com/iphone/marketing/ ...
    * iPhone App Store Artwork License Agreement
    * App Store Identity Guidelines for developers
    * Available on the iPhone App Store logo artwork & Apple-provided iPhone Imagery
    ...& just for grins...
    http://www.apple.com/legal/trademark/appletmlist.html

  • External Harddrives - Manufacturers using the words 'for Mac'?

    Hi,
    I've learnt about the difference between PC and Mac HDD formats, and was about to buy an external HDD when something got me questioning my knowledge. I see that some manufacturers use the words 'for Mac' in their product name. And that the models with 'for Mac' in the name are about 20% more expensive than the same model name without the 'for Mac' wording. Eg
    http://www.wdc.com/en/products/products.asp?driveid=700
    http://www.wdc.com/en/products/products.asp?driveid=719
    The manufacturer specs don't seem to explain anything, so I wanted to ask here: are these products exactly the same, except that the 'for Mac' version comes pre-formatted in HFS Plus?
    Can I just buy the standard model, and then do the formatting myself with Disc Utility?
    I questioned my knowledge, because it seems daft that a manufacturer can charge 20% more just for pre-formatting the disc in the correct format. Is there anything special about the 'for Mac' models?
    Are there any other considerations I need to make? Is there anything special I need for the disc to work with Time Machine?
    Thanks,
    Yeti

    Hi Yeti
    Welcome to Apple Support Communities
    You can reset the Partitions Scheme and Format of most all off the shelf External HD's. I have several that came MS-DOS/FAT-32 that I have changed to GUID Partition Table/Mac OS Extended (Journaled)
    See > http://www.kenstone.net/fcphomepage/partitioningtiger.html
    Some manufactures include partitions with windoz backup programs that should be eliminated, as they are of no use to you anyway.
    Time Machine will format the drive to it's own liking, however I always reset the Partition Scheme and Format to make sure it is properly cleaned and setup.
    See: Time Machine 101 > http://support.apple.com/kb/HT1427
    and Time Machine -- Frequently Asked Questions > http://discussions.apple.com/thread.jspa?threadID=1964018
    Lastly you might want to consider a desktop drive over a portable for Time Machine, Time Machine need lots of room and you can get more GB for your money.
    Dennis

  • Help with using the WRT54G as an Access Point

    Ever since I've been using the WRT54G as an access point behind another router I have been experiencing intermittent disconnects and reconnects from the internet anywhere from once every 5 to 60 minutes.  I get the message notifcation that the Local Area Network is disconnected for a split second before everything reconnects and works fine.  This has been happening on my desktop which is wired directly to the WRT54G which itself is wired directly to the other router, but I have also experienced these disconnects with my iPhone and laptops which have been using the wireless signal. 
    When I was connected directly to the original router I hadn't experienced any of these problems.  I've also tried changing settings and even disabling the wireless broadcast of the WRT54G but to no avail.  I can't figure out what the issue is, but it seems to also be affecting the wireless broadcast of the original router. 
    I've updated firmware for the Linksys, and I've done a reset for the Linksys as well.
    Any help would be much appreciated to get rid of these disconnects.

    OK, so I've tried a different setting to see if it'll work. 
    Previously I had not configured the WAN of the Linksys router at all and left it on Auto (DHCP) even though I disabled the DHCP for the LAN.  I've now set the WAN up to a random Static IP and hopefully this will solve the problem, but I'm not sure as of yet, if anyone could look over the settings to see if they're correct please let me know.
    Router 1- (Router)
    WAN - Configured to ISP
    LAN - DHCP
    IP: 192.168.1.1
    Subnet: 255.255.255.0
    IP Range: 192.168.1.100 - 192.168.1.150
    Router 2 - Linksys (AP)
    WAN - Static IP
    IP: 64.XXX.XXX.1 (made up value)
    Subnet: 255.255.255.0
    Gateway: 64.XXX.XXX.254 (made up value)
    DNS: XX.XXX.XXX.X (made up value)
    LAN - DHCP disabled
    IP: 192.168.1.2
    Subnet: 255.255.255.252
    The WRT54G was a bit of a pain in terms of what Static IP and Gateway values they would accept, so I had to randomly put in values until I found something that worked.  So far no disconnects, but it's only been half an hour.  I can't seem to access the admin page for my Linksys router at 192.168.1.2 anymore though.

  • I created a 5x7 postcard document in Word with text boxes and graphics.  When I converted it to PDF, some of the items were missing, even though they were in the boundaries of the page and looked fine on the Word document.  What happened, and how do I fix

    I created a 5x7 postcard document in Word with text boxes and graphics.  When I converted it to PDF, some of the items were missing, even though they were in the boundaries of the page and looked fine on the Word document.  What happened, and how do I fix it?  I'm trying to upload the PDF version to Vistaprint.  Thanks.

    Reader doesn’t create pdf files. You can use Acrobat (ask in that forum) to create pdfs. You can subscribe to the Adobe PDF Pack which has a create pdf functionality (please ask in that forum), or you can use a third party utility such as ghostscript, cutepdf, or Microsoft’s own PDF creation capability. For third party pdf creation you will need to ask in a forum dedicated to that software as fellow users of Reader are unlikely to have the knowledge to help.

  • In Adobe Digital Editions a ding sounds everytime I use the arrow buttons to scroll...how do I stop this?

    In Adobe Digital Editions a ding sounds everytime I use the arrow buttons to scroll...how do I stop this?

    You may have switched on [http://kb.mozillazine.org/accessibility.browsewithcaret caret browsing]: press F7 to toggle.
    See http://kb.mozillazine.org/Scrolling_with_arrow_keys_no_longer_works
    Tools > Options > Advanced : General: Accessibility: [ ] "Always use the cursor keys to navigate within pages"
    See also http://kb.mozillazine.org/Accessibility_features_of_Firefox

  • I just got my Mac and I used my family Apple ID. It had all of my parent's information, I added my e-mail.I wanted to make my own Apple ID, but I couldn't use the same e-mail address again! How do I delete this information so I can make my own Apple ID?

    I just got my Mac and I used my family Apple ID. It had all of my parent's information, I added my e-mail.I wanted to make my own Apple ID, but I couldn't use the same e-mail address again! How do I delete this information so I can make my own Apple ID?

    Wendy P-G wrote:
    I just got my Mac and I used my family Apple ID. It had all of my parent's information, I added my e-mail.
    It is not clear how or where you "added" your email, but you cannot create an Apple ID using an email address that is already associated with another Apple ID.
    If that is what you did, delete that email address from your family's Apple ID. You should be free to create a new one.
    Do all that by starting here: https://appleid.apple.com/
    Select "Manage your Apple ID". Log in with your family's Apple ID and then delete your own email address wherever it appears.
    Save Changes, log out, and create the new one using the same website. This time select "Create an Apple ID".
    Please don't forget your security questions, and be sure to specify a "rescue email address" that is separate from all other Apple IDs. You will avoid so many problems that way...

  • I purchased an album and didn't receive all of the cuts.  I have Itunes 9.2.1 so I can't use the new  "download past purchases" feature.  How do I get the rest of the songs?

    I purchased an album and didn't receive all of the songs.  I have iTunes 9.2.1 so I can't use the new 'Downloading past purchases" feature. How do I get the other songs?  Using an Iphone 3Gs

    Look under the Store menu in iTunes on your computer for the "Check for available downloads" command and run that. You may find the tracks there to be downloaded.
    If not, contact the iTunes Store Customer Service department from their Support page (select the category and subcategory closest to the issue you're reporting and you'll find either an "Express Lane" button - just follow the instructions to get to the contact form, or an "Email Us" button) and explain the problem to them.
    Regards.

  • I have Pages 09 and I have  created a business card using the template but can't figure out how to duplicate it to the other 9 on the page Am and sure I am going to look daft coz its only the click of a button but I can't work it out Thanks

    I have Pages 09 and I have  created a business card using the template but can't figure out how to duplicate it to the other 9 spaces on the page. I am and sure I am going to look daft coz its only the click of a button but I can't work it out Thanks

    I do the following: Hold down the command key and highlight all the items to be reproduced. Then hold down option and drag the items from the first to each subsequent card.

  • I just bought the new ipod touch, but when I try to sync it I get told to use the cloud and download from there.  How do I sync it to my itunes so that I get all my songs without going through cloud? Otherwise if this isn't possible I am taking this back!

    I just bought the new ipod touch, but when I try to sync it I get told to use the cloud and download from there.  How do I sync it to my itunes so that I get all my songs without going through cloud? Otherwise if this isn't possible I am taking this back!

    Thanks for no help... but for anyone else, turn off itunes match on the ipod

  • I recently restored my iphone. When i tried to set it back up, it will not accept my apple id password.  Yet I can sign in the the apple store using the same apple id and password.  How do i get my iphone to accept my apple id?

    I recently restored my iphone.  When attempting to set it back up it will not accept my password.  Yet when i log into the apple store i have no problem logging in using the same apple id and password.  How do i get the iphone to recognize my apple id and password?

    Try This...
    Close All Open Apps... Sigh Out of the Account... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430
    More Info Here  >  Troubleshooting FaceTime
    http://support.apple.com/kb/TS3367

  • I JUST BOUGHT AND INSTALLED A LINKSYS E1200 WIRELESS N ROUTER AT HOME. MY IPHONE CONNECTS WITH A STRONG SIGNAL BUT WHEN I TRY TO USE THE INTERNET IT JUST LOADS FOREVER. HOW CAN I FIX THIS?????!!!!

    I JUST BOUGHT AND INSTALLED A LINKSYS E1200 WIRELESS N ROUTER AT HOME. MY IPHONE CONNECTS WITH A STRONG SIGNAL BUT WHEN I TRY TO USE THE INTERNET IT JUST LOADS FOREVER. HOW CAN I FIX THIS?????!!!!

    RESET YOUR ROUTER
    No. Reset your router.

  • In the new IOS 7, my IMessage and FaceTime won't let me log in using the correct Apple ID and password. How can I fix this?

    In the new IOS 7, my IMessage and FaceTime won't let me log in using the correct Apple ID and password. How can I fix this?

    Other users have reported same problem with 4G iPod/iOS 6.1.6 and I have not seen a solution. One user reported yesterday or the day before that it just started working again.

  • TS1702 I no longer want to use the Pandora one app with automatic renewal how do I quit it so it stops charging my credit card??

    I no longer want to use the Pandora one app with automatic renewal how do I quit it so it stops charging my credit card??

    http://support.apple.com/kb/ht1918
    http://support.apple.com/kb/ts5366

Maybe you are looking for

  • Problem with groupLink items in combination with jhs Lovs in jhs 11

    We encounter a strange behaviour when using jhs items of type groupLink to open the linked group in a modeless/modal popup window. First of all when we close the popup window the following exception is thrown in the logs: 04-Mar 13:40:33 DEBUG (TaskF

  • I don't remember the answers on the security ID, how can I recover them.

    I forgot the answers, At the moment i didn't think they were important, but now I can purchase anything and don't know how to enter new ones. Please help!

  • About This Mac screen in Lion still that of Snow Leopard

    I recently wiped my MBP's drive, installed Lion and migrate all my apps and data manually. After I got settled in I remebererd Lion was supposed to have this fancy new "About This Mac" screen. I was very disappointed to find my system does not have i

  • WRITEQUERY program output issue..

    hi, we are using writequery program for one of our apps. when using writequery prg. the description is not displalyed completly in the output, but displays properly in BEx query output. Any thoughts on this issue..we have to use writequery for our ap

  • ESS CATS Timesheet without Project Systems

    Hi experts, My customer have ECC EhP7. So far the customer uses a .NET based custom web based application to book time against projects. Possibly the project information are stored somewhere in the background database the custom application is connec