Accessing members and intertance

Greetings:
I wrote up a couple of very simple classes to test my understanding of Accessing Inherited Members. In the "Java Programming Language 3rd Edition" page 75 it says "When you invoke a method through an object reference, the actual class of the object governs which implementation is used. When you access a field the declared type of the reference is used."
This is what I my trying to test and I managed to confuse myself and a co-worker very well. Please find my classes below and my questions futher below.
code:
package testadd;
class Car {
int zero2Sixty = 12;
void goFast() {
System.out.println(" Car goes fast. Zero to Sixty in: " + zero2Sixty);
void stepOnPetal() {
goFast();
int getZero2Sixty() {
return zero2Sixty;
class BMW extends Car {
int zero2Sixty = 8;
void goFast() {
System.out.println(" BMW goes fast. Zero to Sixty in: " + zero2Sixty);
// int getZero2Sixty() {
// return zero2Sixty;
// End
package testadd;
public class Untitled1 {
public Untitled1() {
public static void main(String[] args) {
Car aCar;
BMW bmer = new BMW();
aCar = bmer;
bmer.stepOnPetal() ;
bmer.goFast() ;
aCar.stepOnPetal() ;
aCar.goFast() ;
System.out.println("bmer.zero2Sixty:" + bmer.zero2Sixty );
System.out.println("aCar.zero2Sixty:" + aCar.getZero2Sixty() );
System.out.println("bmer.zero2Sixty:" + bmer.getZero2Sixty() );
// End
BMW goes fast. Zero to Sixty in: 8
BMW goes fast. Zero to Sixty in: 8
BMW goes fast. Zero to Sixty in: 8
BMW goes fast. Zero to Sixty in: 8
bmer.zero2Sixty:8
aCar.zero2Sixty:12
bmer.zero2Sixty:12
I do not understand why the last two methods return 12
What is the difference between the call to stepOnPetal and getZero2Sixty()?
Thanks in Advance.
Regards
kd

Hi,
The field zero2Sixty is duplicated. I.e The field exists in both classes.
stepOnPetal() always calls the goFast(), which is overridden in BMW, so it uses the correct value for the attribute zero2Sixty.
getZero2Sixty() is not overriden in BMW, so it returns the value in Car.
An easier answer it that the code you have written is the same as defining an attribute in car, and another one in bmw. They aren't related to each other.
/Kaj

Similar Messages

  • HT3819 I would like to be able to access books purchased by other family members and read it on my IPad

    I would like to access books purchased by other family members and read them on my Ipad2

    You need to download the books with their iTunes account and password.
    http://support.apple.com/kb/HT2519

  • MS Access, SharePoint and Security

    Let's say I sign up for Office 365.
    I use the SharePoint Site that comes with it to house my MS Access Lists and my compiled database *.accmde file.
    Can I set up a separate sub-site with only admin access to house a list of userID's and passwords so that when the user runs the database, it looks up this list and identifies the user, type of user, and which filter for the data in the full access sites.
    If that works, then I would also want to put the data in a limited sub-site and have the accmde file retrieve that data behind the scenes. I would like to limit accidental access to the data if at all possible.
    Any suggestions on how to design the tool for this?
    Frank

    Hi FrankHayAlexcander
    It seems you have the following questions about hosting Access data on Office 365
    Can Access connect to multiple SharePoint sub-site?
    Can you store User info in one sub-site to control what data the user sees?
    Can you hide these sub-sites so that users can't accidentally see this data?
    The short answer is that I'm not sure that what you are trying to do is even possible in a Web database published to SharePoint, and certainly would be very difficult in a traditional database.
    If you create a Web database in Access 2010 and publish it to SharePoint, then it is limited to the tables / SharePoint Lists in that sub-site.
    In this case the credentials of the user are passed to SharePoint to retrieve data. This means that to read the list the user would have to have permissions and so they could go out the site directly and see the same data.
    Using SharePoint permissions you could control what the user can see, but Access isn't going to be able to add much to that.
    If you create a traditional database, then you can link to lists in multiple SharePoint site as well as other providers like SQL, and Excel.
    When you created the link table here you have the option to store the credentials with the linked table.
    If you do not store the credentials the user will be prompted for the credentials to use.
    You could store the credentials for an Admin user when you link the table, but the problem is that if a user opens your database in the full version of Access can get to the linked tables, they will be able to see all of the data anyway.
    When it comes to security, the best answer is always to secure the data using the native features of the data store such as SharePoint, SQL, etc.
    Best Regards,
    Nathan Ost
    Microsoft Online Community Support
    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Install Access 97 and Office 2007 on Windows 7

     
    Hopefully this is a useful discussion for anyone wanting to run Access 97 on Windows 7 especially if the intention is to also load Office 2007
    or 2010 in addition to Access 97.
    I have successfully installed Access 97 SR-2 starting from the Office 97 Professional CD for SR-1.
    The level of Windows 7 (64 bit Professional Version) was as installed on a new Dell machine in July 2010.
    I then loaded Office 2007 as the main office system. As mentioned elsewhere the requirement to also load Access 97 is often dictated by the need to maintain
    legacy applications which continue to be run very successfully at this level of software under Windows XP or similar.
    The full procedure and list of problems overcome is as follows:-
    1)    
    Make a custom installation of Office 97 into an Office97 folder selecting only Access and its associated data utilities.
    2)    
    The error message CTL3D32.DLL not correctly installed – must be installed in the Windows System Directory can be ignored. Should find it is already in the
    Windows\System32 directory.
    3)    
    If you now run the SR-2b update (SR2bOF97.EXE) for Office 97 it will fail unless you do the following:-
    a.     
    create two new temporary folders – say folder97 and foldersavefonts
    b.     
    copy the windows fonts relating to tahoma and comic (4 files) from \windows\fonts to foldersavefonts.
    c.     
    extract the files from SR2bOF97.EXE to folder97 using Winzip or similar.
    d.     
    select the four font files relating to Tahoma and comic and right click to then install these fonts in Windows 7.
    e.     
    if you do not do the above the SR-2 install fails because of a version problem with the fonts.
    f.      
    now run SR2bOF97.EXE in the normal way. It should be successful – if not the situation is different to mine and the log will need to be viewed to troubleshoot
    the problem
    g.     
    finally go to foldersavefonts and install these fonts back into Windows 7.
    4)    
    It is now recommended to run the Jet3 patch
    Jet35sp3.exe which can be downloaded from Microsoft.
    5)    
    At this point you should have a fully working Access 97 system. This procedure should also work for Word, Excel and Powerpoint but not Outlook.
    6)    
    Now install Office 2007/10 as required preferably a custom installation into an Office20xx folder.
    7)    
    If you have installed Access 20xx there will be a conflict between the Access 97 and 20xx installations. Both version work fine (ignore the message to rerun setup)
    once loaded but Access 97 will need to be run with Administration permissions (right click the short cut and click administrator) after running Access 20xx. In a similar way Access 20xx will rerun its registration processes after running Access 97. This situation
    occurs whenever you move between the versions unless you follow the following steps.
    8)    
    Load Access 20xx to ensure that it is registered.
    9)    
    Use notepad to create an empty file MSACCESS.SRG – suggest in folder97
    10) 
    find the Microsoft supplied MSACCESS.SRG – this is installed in the folder name specified in the custom install of Office 20xx. Rename this file to MSACCESS.SRG.SAV.
    11) 
    Copy in the empty MSACCESS.SRG from folder97 to replace the correct version.
    12) 
    This trick seems to prevent the conflict between Access 97 and Access 20xx. Remember if any reinstall work is needed for Office 20xx to reinstate the Microsoft
    supplied version.
    13)  There
    is a documented problem
    http://social.technet.microsoft.com/Forums/en/w7itproappcompat/thread/4f729cea-aafb-4d4a-b863-705a13de486a relating to a UAC issue but this seems to have been corrected in currently shipped builds of Window 7. If the problem does appear there
    is a Microsoft supplied fix for the problem.
    http://support.microsoft.com/kb/978591/
    14) 
    Finally, in case anyone needs to make a clean start in new folders. I have also found that the above procedures are still repeatable after standard uninstalls
    of both Office 97 and Office 20xx
    15) If ISAM problems occur with txt or .xls files it is likely that the .DLLs need to be manually registered. To do this use
    the command line and type C:\windows\syswow64\regsvr32.exe c:\windows\syswow64\mstext35.dll. This will register mstext35.dll. Then type:- :\windows\syswow64\regsvr32.exe c:\windows\syswow64\msexcl35.dll. This will register msexcl35.dll
    If anyone finds additional problems or information would be pleased to see them posted here.

    Hi,
    Thanks
    for
    sharing your effort and
    experience in forums,.
    Hope your information would help more community members facing the same situation.
    Best Regards,
    Alex zhao

  • Customize class members and methods showed by IDE

    Is anyway to customize the output of the class members and methods show by IDE when you code a class?
    In detail:
    If you have a class A:
    A myClass = new A();
    and you tipe myClass.
    then the IDE show you a list of class members and methods in a Dialog Box....
    can you customize these????????
    I want to set another output for these....
    Thanks!

    That's not the meaning of the question.....
    When someone work with a Java IDE and are editing source, the IDE help you writing code showing you the members and methods of the object that you are working on, like these:
    a.------------------------
    | void setX(int x) |
    | void setY(int y) |
    These information is provided by the IDE. I think that it makes a special type of introspection on classes ..... but a really strong one, because it can access to private members and methods....
    I want to customize these behaviour....... and i want the IDE's show only the strings that i want....
    For exemple:
    a.------------------------
    | to establish X |
    | to establish Y |
    Thanks!

  • How to create members and properties in BPC for Excel...

    Hello,
    Is it possible to maintain and create members and properties from an input schedule of BPC for Excel?
    We want to give access to the end users to maintain one dimension (invoices) from an input schedule of BPC for Excel,  in order that they will create new invoices and give properties for them... (But not accesing using BPC for Administration Console) they must access using an Excel input schedule.
    Thanks,
    Jorge

    BPC is a Business Warehouse tool rather than an Accounting system. In other words, BPC is designed to do data analysis and planning, not creating sales documents, etc.
    You should use an ERP system or at least, an Access database or Excel to create your Invoice documents. Then you load to BPC for data analysis or for planning/budgeting.
    It is critical to understand the values and functions of BPC before implementing into your Business Processes, otherwise you WILL spend hundred of thousands of dollars and end up with negative ROI or loss of time and money. To give you an analogy, no matter how well a Ferrari is designed, you don't drive it in off-road conditions. There are many case studies online that try to tell us the importance of recognizing and understanding the purposes/functions/values of the products before we use it in real world, especially in SAP environment.
    Hope this helps...

  • Using Powershell Script Run simple query in MS Access 2007 and export the results of query to Excel

    Hi Experts,
    I have a Access 2007 DB file and 2 Big tables inside that (bigger than the size that can be easily handled by MS Excel 2007).
    My requirement is automate using powershell scripts the below things.
    1. Create a SQL query in Access DB and save that in access DB
    2. Run the saved query and export the result in excel sheet where I can create the charts and Pivots. Thanks in advance
    Prajesh

    Do you have to use the Access query, couldn't you just recreate the query in Powershell?  Here's a link with good info that references an existing script for querying an Access database:
    http://blogs.technet.com/b/heyscriptingguy/archive/2009/08/13/hey-scripting-guy-can-i-query-a-microsoft-access-database-with-a-windows-powershell-script.aspx
    Once you have your dataset you can pipe it to
    Export-Csv -NoType c:\pathtofile\output.csv

  • Can't Find ODBC drivers to link MS Access 2013 and MySQL

    Can't Find ODBC drivers to link MS Access 2013 and MySQL.
    Is one available?
    Thanks,
    Larry

    Could to associate the problem at Office 2013?
    I just installed the ODBC Driver; The data source machine was available; When selected I had received the message. When it was selected I had received the message:
    "ODBC -- falha na chamada.
    [Microsoft][ODBC Driver Manager] O DSN especificado contém uma incompatibilidade de arquiteturas entre o Driver e o Aplicativo (#0)"
    In english, could to say: "ODBC -- fail on call.
    ... The specified DSN contains a architectural incompatibility between Driver and App (#0)"
    I don't know yet the reason for this. Anyone knows?

  • Oracle Streams b/w MS-Access 2007 and Oracle 10g.

    Can we set up Oracle Streams between MS-Access 2007 and Oracle 10g? Ms-Access as source and Oracle 10g as destination database. If so, can any one please give me little heads up with supported doc's or any source of info.

    Help Help....!!!

  • Hetrogenous join: ms access local and oracle on server

    Hello
    I want to know if it is possible to join tables from a local client ms access db and an oracle db on a server. I have used the link feature in ms access and the hsodbc feature of oracle, but the ms access db is local and the oracle is not. Is there anyway that I can control the local access db from a link from the oracle db on the remote server?
    Thanx

    There is no such facility as of now to acces Oracle table from DB2 database or anything.
    You can spool the data into flat file for MS access table and import that data into
    Oracle table.

  • Loading MS Access Table and Data into Oracle

    Hi,
    I have few tables in MS Access. I want to create same layout of tables in Oracle and want to populate data from MS Access tables to Oracle tables.
    Please let me know if there is a way by which I can create tables and load data automatically (thru some option or script)?
    I have Oracle 10g database and its clients.
    Thanks in advance,
    Rajeev.

    You can use Oracle migration workbench
    Loading MS Access Table and Data into Oracle
    It´s very easy to use and good to import
    regards,
    Felipe

  • MS Access Freezes and Closes when I save a draft email via Outlook 2013

    I have Access 2013 Office 365.  When I email a report from access via Outlook 2013 I have problems.  Outlook opens fine. If I hit send everything is fine. However if I save the email as a draft Access freezes and then closes after a 10- 15 sec delay.
    The email is saved as a draft in Outlook but very annoying to have to reopen my Database .
    The message I get is : MS Access has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available
    I tried compact and repair but that didn't help. Also tried turned of add ons. That didn't work.
    Never had this problem with office 2010.  What can I do?
    I just discovered the same thing  is happening in Excel and Word.

    Hi all,
    Thanks for visiting our forum and sharing your experience here. It'll be benefited to our communicator.
    Have a good time.
    Regards,
    George Zhao
    TechNet Community Support

  • MS Access 2010 and TFS problem when I try to "create form team foundaition"

    I am using MS Access 2010 and trying to use TFS for source control.
    I installed MSSCCI for 2010 and the "Access Developer Extensions"
    I am able to create a project in TFS and check in and check out access objects.
    My only problem is when I click on "Create from Team Foundation" it asks me to specify the server and when I click OK it gives me the following error message:
    "Cannot create a new Microsoft Access database from this source code control project. It contains neither a Data and Misc. objects file nor a database name file."
    I have tried different ways and could not get it to work.
    Thanks for your help

    Did you figure out a solution for this!>?
    I am having the same issue.  I can issue a GET and bring down all the objects (including the very files that it says it can't find) - then when "creating from team foundation" I get the same problem.
    https://social.msdn.microsoft.com/Forums/en-US/704a18d7-6687-49c2-8830-a24aa794303e/tfs-2013-with-access-20072010-cant-create-a-local-tfs-copy?forum=tfsgeneral

  • Access 2013 and SharePoint Foundation/Server 2010

    I have a real simple scenario that keeps happening.
    I simple click external data -> More -> SharePoint List from Access 2013 and point it to a SharePonint 2010 list ... then link the list.  It will link and show the data.  Once...  After closing the access file, it just freezes when opening
    it again.
    I've tried this on several windows clients (win7 and 8) and 2 different SharePoint 2010 installs (1 being Foundation, the other being Server).  Both are service packed.
    Any ideas?

    I believe i too am running into this issue.
    I have a CRM application i created in Access 2010 which links to lists on Sharepoint Foundation 2010 (As bundled with Small Business Server 2010) using SSL. I have this application running on various client machines, some on the local network and some via
    the internet. Until now we have been entirely Access 2010 and whenever a new client was required i just copied over the Access front end and it just worked.
    We have a new PC which has Win7 Pro 64bit and Office 2013 Pro. I copied over the front end but when i try and open one of the linked sharepoint lists Access just hangs with the spining circle. I have no problem accessing these lists on SP via Internet Explorer
    and furthermore if i select "Open with Access" and link a list it then opens within Access 2013 OK, (although Windows Security does prompt for the users password). However, if i save this database and re-open it i can no longer open the list!!
    I have noticed that if i run Access 2013 as administrator and open the front end application then there is no problem.
    Possible permissions issue???
    If i repeat what Eric describes, Access 2013 shows me all the lists on out SP site and successfully links it (i.e. It appears under Tables) however, unlike Eric the list won't open (not even once).

  • Time Capsule Access Control and Extended Network Question

    I have a Time Capsule where I have set up a wireless network access list…and extended the network using an Airport Express unit. The Airport Express unit also has settings for an Access Control list. Do these need to be the same as the those for the network from TC that it is extending…or does that happen automatically…and if not what on earth are they for?
    Thanks for any help…this doesn't seem clear from what I've read/seen.
    James

    I have a Time Capsule where I have set up a wireless network access list…and extended the network using an Airport Express unit. The Airport Express unit also has settings for an Access Control list. Do these need to be the same as the those for the network from TC that it is extending…or does that happen automatically…and if not what on earth are they for?
    Unfortunately, they are not automatically applied to each base station in an extended network. You would have to manually enter the exact same list in each base station.

Maybe you are looking for

  • BW Statistics queries Can any one help me

    Dear Gurus, I had Implemented BW statistics in my project.  Could u people send me any documents which contains some queries built on BW stats Info Cubes, and their uses(to analyze what they are used).  I am in urgent need of them So, Please help me

  • TREX Search issue

    I am using TREX search for equipemnt in R/3 itself. It is working fine in sand box environment but has some issue in quality server. It is not filtering data for one maintenance plant. For Ex. - When I give a keyworld and maintenance plant A as param

  • [svn:fx-trunk] 13206: Fix a recent regression from 13169

    Revision: 13206 Revision: 13206 Author:   [email protected] Date:     2009-12-23 12:53:43 -0800 (Wed, 23 Dec 2009) Log Message: Fix a recent regression from 13169 QE notes: None. Doc notes: None Bugs: SDK-24849 Reviewed By: Darrell Tests run: checkin

  • Select inside loop into for all entries or joins

    Experts please help in making it into for all entries or joins. suppose assume this zuser table has 2 fields usage and kunnr. in i_table i always have 2 fields. type number type will store user or nonuser and number can store customer number or sales

  • Cost model derivation rules error

    Hey PS upgraders, We are upgrading 4.6c to 6.0. When I m uploading the cost model from 4.6c to 6.0 thru CKCM , derivation rules are missing in 6.0. Does any one come across this kind of issue in 6.0. Thanks, Krishna Reddy Edited by: krishna.gujju on