I need clarification regarding REFERENCE TYPES and CASTING.

Hello all,
I'm taking a course on the fundamental of JAVA. Everything's been going smoothly until I slammed into the the concept of CASTING and REFERENCE TYPES. Flat--out == I DON'T GET IT?
I'm having trouble with...
CONVERTING REFERENCE TYPES
CASTING BETWEEN REFERENCE TYPES
WORKING WITH REFERENCE TYPES
I understand what's happening from an academic vantage point. I just don't understand why you'd want to convert REFERENCE TYPES? What would be an application of such an exercise?
1. What IS a REFERENCE TYPE -- exactly?
a. what are we referencing?
b. type? type of what??
for example... why would you want to do a widening conversion, a conversion of the hierarchy tree?
I understand the concept of OBJECTS, CLASSES, METHODS and CONSTRUCTORS so far...
I think it's the terminology that's screwing my up.
Thanks,
Alex

ok... wow, thanks J.
So--in a nutshell-- we're making it so that different
objects:
ie,. ford(), chevy(), honda(), lotus() and
dealers()... so and so forth()...
all share the resources(for lack of a better word) of
the Auto Class? because all of those auto brand
objects and one redically different object can be
unrelated, correct?Um, yes and no.
I just ran with the example you had, but that probably included too many concepts and they got muddied up.
Yes, Chevy, Ford etc. all share the characteristics of Auto, since they're all subclasses. But that's just inheritance, and has nothing to do with casting.
A "reference type" can loosely be described as a variable that refers to an object. (Constrasted with "primitive types" which are int, char, float, etc. and don't refer to objects--they just hold values.)
Casting just tells the compiler that even though as far as it knows you only have a reference to some superclass, the object that reference points to will in fact be an instance of a subclass, and so treat it as such (e.g., we can now call methods that the subclass has that the superclass lacks).
(You can also cast primitives, but one thing at a time.)
So let's say you have class A (which extends object) and B extends A.
A a = new B();
B b = a; // won't compile. compiler sees the "A a" on the left of the =, not "new B()" on the right.
B b = (B)a; // works because we're telling the compiler, "Dude, I'm seriously. This is a B.
Note that if we had done new A() instead of new B(), it would still compile--the compiler would trust us. But at runtime, we'd get a ClassCastException, since we wouldn't actually have a B object.
/**folks, I'm a web designer that has to learn Java
so that I can perform my duties as a JSP author here
at work. I tried to learn JSP sans Java and that was
a simple exercise in ignorance.-- it's really hard
without understanding the root concepts of Java and
for that matter, C. Concepts like "polymorphism,
inheritance, object references... are completely
foreign to me. **/It's a rather big leap from web designing to OO concepts. Take your time, and don't be discouraged if you feel completely confused. It's a prerequisite. :-)

Similar Messages

  • Needs Clarification Regarding Segments and Datafiles

    Hi,
    I want clarification regarding Segments, Datafiles and extents.
    As we know that A segment is made of one or more extents and extents are composed of one or more datablocks in the HD.
    Since all data are store in Datafiles which are composed of extents and datablocks. I want to know weather a table(Segment) can span to multiple datafiles or in a sigle datafile.
    Regards,
    D.Abbasi

    And an easy way to check it by yourself :
    SQL> create tablespace abbasi_tbs
      2  datafile 'E:\ORADATA\DEMO111P\abbasi_01.dbf' size 1m autoextend off,
      3           'E:\ORADATA\DEMO111P\abbasi_02.dbf' size 1m autoextend off;
    Tablespace created.
    SQL> create table abbasi_tbl (id number)
      2  tablespace abbasi_tbs;
    Table created.
    SQL> insert into abbasi_tbl
      2  select rownum as rn
      3  from   dual
      4  connect by level <=10000;
    10000 rows created.
    SQL> commit;
    Commit complete.
    SQL> select distinct file_id
      2  from   dba_extents
      3  where  segment_name ='ABBASI_TBL';
       FILE_ID
             6
             7
    or...
    SQL> select distinct DBMS_ROWID.ROWID_RELATIVE_FNO(rowid)
      2  from   abbasi_tbl;
    DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID)
                                       6
                                       7
    SQL> select file_name from dba_data_files where file_id in (6,7);
    FILE_NAME
    E:\ORADATA\DEMO111P\ABBASI_01.DBF
    E:\ORADATA\DEMO111P\ABBASI_02.DBF
    SQL>Nicolas.
    added the ROWID function usage
    Edited by: N. Gasparotto on Jun 21, 2009 11:02 AM

  • Diff b/w reference type and elementary type

    hi all
    can any one what is the diff b/w reference type and elementary type in data element ....
    thanks
    lokesh

    The data type attributes of a data element can be defined by:
    Specifying a domain whose attributes are copied by the data element.
    Specifying a build-in type where the data type, number of places, and possibly decimal places can be directly specified.
    Specifying a reference type, i.e. reference to a class, an interface, a type defined in the Dictionary, a built-in type, or a generic reference to ANY or DATA.
    In the maintenance screen you can set the option you require by setting the appropriate flag (domain, built-in type, reference type) and filling in the corresponding input fields.
    A reference type is a reference to another type. There are the following kinds of reference types:
    Reference to a class or an interface
    Reference to a type defined in the Dictionary
    Generic reference to ANY, OBJECT, or DATA
    Reference to a built-in Dictionary type with specification of the length and possibly also the decimal places
    You can use a reference type to define the data type properties for a data element, or for typing the component of a structure or the line type of a table type.
    In the field Referenced type, enter the name of a class, an interface, the generic references DATA, OBJECT, ANY, or the name of a type defined in the Dictionary. If the reference type is to be a predefined Dictionary type, choose the reference to the predefined type. Enter the number of characters and, if required, the number of decimal places.
    where as
    The data class describes the data format at the user interface.
    If a table field or structure field or a data element is used in an ABAP program, the data class is converted to a format used by the ABAP processor. When a table is created in the database, the data class of a table field is converted to a corresponding data format of the database system used.
    You can find a detailed description of the data classes allowed in the ABAP Dictionary in Overview of the Data Classes.

  • Regarding output type and idoc trigger issue

    Hi
    i need to copy pgi quantity into sales order quantity for that i write a code into user exit MV50AFZ1. code is working fine but
    output type and idoc is not trigger due to this. In this exit to update sales order quantity i used bapi *BAPI_SALESORDER_CHANGE . can anyone tell me why o/p type and idoc not trigger ,what is the reason and what is the solution for this?
    Thanks
    Dinesh

    Hi Dinesh,
    Did you activate the enhancement for user exit ?
    Did you check if the output type is configured correctly ?
    Put a debugging point and see if control is coming there.
    Regards,
    Nisha Vengal.

  • Regarding Industries type and including the material types in indu sector

    Hi Gurus,
    I have query regarding the above subject.
    i want to add my own material types to my own inds sectors in MM01 screen.
    I dont know how to do that?
    Please help me.
    Pran

    Hi,
    OMS2 - Material Type
    Here you can select the standard material type and copy to new one
    OMS3 - Industry Sector
    Here create industry sector by "New Entries" and assign the field reference as per requirement.
    Then check in MM01, it will start appearing.

  • Clarification regarding Reference application & Source application

    Hi
    What is the purpose of Reference application and Source application
    While we create new application why we choose reference application & source application
    please clarify me, why we give
    source application as Planning,
    source application type as Finance
    rate application as Rate
    sometimes Source application as Sales
    Regards
    Luci

    Hi,
    Source application is the application from where the templates will be copied into the new application. Every application has few inbuilt templates (for reports, input schedules, DM packages, etc). These objects are copied from the source application to the newly created application.
    Application type determines what is the purpose of your application. Whether is should be a reporting or non-reporting type? Whether the purpose is to do planning or consolidation? You will get more information on this from the below link from help.sap:
    http://help.sap.com/saphelp_bpc75_nw/helpdata/en/01/a7e059f56847eea751fb0fd28f07f3/content.htm
    http://help.sap.com/saphelp_bpc75_nw/helpdata/en/97/a99d939fb14bdab9d1ac7f2b43525e/content.htm
    Hope this helps.

  • Needs Advice on Record Type and Views!!!

    Hello all,
    I have a package that returns a record type based on some arguments. I have a view that wants use a column from that record type. Obviously, I cannot call the package from the view.
    I started looking into objects type, maybe use it instead of record type so that I can create a table on the object type and then use my object type table in my view. The problem is, I still have to call my package and passed the arguments to get the right data.
    Could any of you help me direct me on how to deal with this kind of issues? I have also looked into member funtion but not sure. I am aware that I can write a function by itself and use the function in my view. But I was thinking in more of lines of completeness of my code that can serve all my needs, if possible.
    A reply will be appreciated. Thank you.

    I read about Panasonic AG-DVX 100 Cam that shoot in 24f and before its print in FCP, the pull down takes it to 29f.
    And the Sony i believe shoot near enough the same as the Panasonic.
    So if that's the case would the conversion of FCP for the pull down come out alright, there is no point really in jumping to another Forum when the integration is with FCP!
    Just need to get a cam that integrates well with FCP for a budget of under $4,000.00 and in the range of 29.97f,
    Fr.BlayZay.

  • Urgent information required regarding message type and process code

    Hi All
    We am working on EDI895 transaction (Delivery/Return acknowledgment) and we are using TXTRAW01 Idoc type for the mapping. Can anyone please let me know what the message type and the process code for the IDoc type is???
    thanks

    Hi,
    Welcome to SDN.
    Please go to transaction WE64 to find out all process codes available for IDoc type TXTRAW01 with message type TXTRAW.
    There are four process codes for message type TXTRAW.
    - ED00
    - ED00_XML
    - ED08
    - TXT1
    Regards,
    Ferry Lianto

  • Needs Clarification Regarding Listener.ora file

    I want a clarification regarding listener.ora file I've Listener.ora file and its content look like as:
    # listener.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\listener.ora
    # Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = Oracle8)
    (SID_NAME = ORCL)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.10)(PORT = 1521))
    I can understand every entry in this file accept the following
    *(SID_DESC =*
    *(SID_NAME = PLSExtProc)*
    *(ORACLE_HOME = C:\oracle\product\10.2.0\db_1)*
    *(PROGRAM = extproc)*
    *(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))*
    Although rest of entries refer to network services(Database name) and host address and protocol etc.
    what these above refere to.
    Please clarify me in this.
    Regards,
    D.Abbasi

    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
    (PROGRAM = extproc)
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    that about External Procedure, If you don't use "External Procedure" you can remove it, by the way you should avoid default configure.
    http://download.oracle.com/docs/cd/B19306_01/network.102/b14212/advcfg.htm#sthref1331
    http://download.oracle.com/docs/cd/B19306_01/network.102/b14212/advcfg.htm#NETAG0132
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_extern_proc.htm#sthref1658
    Sample create External Procedure:
    http://surachartopun.com/2008/07/create-and-run-sample-external.html

  • Need clarification regarding the test cable-diagnostics tdr command

    Hello,
    I've read about the test cable-diagnostics tdr command but I need clarification on the examples listed below to make sure that I am providing the right answer to my co-workers.
    Example 1:
    CXXX7SW17#show cable-diagnostic tdr int g0/20
    TDR test last run on: July 16 10:23:00
    Interface Speed Local pair Pair length        Remote pair  Pair status
    Gi0/20    auto  Pair A     N/A                        N/A                Normal
                           Pair B     72   +/- 10 meters  N/A                Open
                           Pair C     75   +/- 10 meters  N/A                Short/Crosstalk 
                           Pair D     74   +/- 10 meters  N/A                Short/Crosstalk
    Does this example mean that there's a cable length issue in the line which is causing the device that it's connected to not to work properly?
    Example 2:
    CXXX2SW140#show cable-diagnostics tdr int g0/21
    TDR test last run on: July 16 09:16:22
    Interface Speed Local pair Pair length        Remote pair Pair status
    Gi0/21    100M  Pair A     N/A                      Pair A           Normal
                              Pair B     N/A                      Pair B           Normal
                              Pair C     N/A                     Pair C           Normal
                              Pair D     N/A                     Pair D           Normal
    Does this example state that the cable line is okay for use?
    Example 3:
    CXXX1SW19#show cable-diagnostics tdr int g0/22
    TDR test last run on: July 16 06:36:53
    Interface Speed Local pair Pair length            Remote pair Pair status
    Gi0/22    auto    Pair A       1    +/- 10 meters  N/A               Open
                              Pair B     39   +/- 10 meters   N/A               Open
                              Pair C     72   +/- 10 meters   N/A               Open
                              Pair D     1    +/- 10 meters    N/A               Open
    Does this example mean that there isn't a device connected on the other end? No pin-contact?
    Thank you very much for any help you could provide.
    S

    I found this article here at supportforums that seemed like the best explanation I've read so far for TDR info.
    Hope that helps.

  • Need clarification regarding select query

    Hi,
    I need a little clarification regrding a Select senario
    I want to select data from table which have been minupulated between a certian date like between 1-DEC-10 to 31-DEC-10 and note that table does not have any time/date column. I've applied the following query to do this.
    select * from TABLE_NAME where sysdate between to_date('01-DEC-10') AND to_date('31-DEC-10');
    Would it work fine because I've tried it against a table and it returned me nothing however DML occur between time period.
    Regards,
    Abbasi

    Abbasi wrote:
    Hi,
    I need a little clarification regrding a Select senario
    I want to select data from table which have been minupulated between a certian date like between 1-DEC-10 to 31-DEC-10 and note that table does not have any time/date column. I've applied the following query to do this.
    select * from TABLE_NAME where sysdate between to_date('01-DEC-10') AND to_date('31-DEC-10');
    Would it work fine because I've tried it against a table and it returned me nothing however DML occur between time period.
    Regards,
    AbbasiAFAIK without log mining and auditing this is not possible.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/logminer.htm

  • Need clarification for cold backup and recovery

    Hello Everyone ..
    I have much confusion on cold backup and recovery topic.
    Already i posted a scanario regarding this and i want to know some clarity points to understand.
    1. I had cold backup two days before
    2. I am creating an object *(EMP)* and inserting some records then issue log switch continiously.
    3. Manually i removed all physical files (datafiles , control files , log files , redolog files ...)
    4. then i issued STARTUP FORCE MOUNT;
    5. here i am getting error identifying control file.
    6. cold backup two days before all files restored
    6. then i issue recover database using backup controlfile until cancel;
    7. i am trying to issue select * from emp; i am getting error
    select * from emp
    *ERROR at line 1:
    ORA-00942: table or view does not existMy QUESTION IS
    After cold backup finished , i created emp table ..
    when restoring old back " There is no emp table"
    *- then , can i recover emp table ? - If so , please explain about this ..*
    Note : REF - LINK https://forums.oracle.com/forums/message.jspa?messageID=11056341#11056341
    - Above link says what i did ? . In this thread i am asking concept & logic ..
    please do NOT consider as "*DUPLICATE*"

    When you recover the database using backup controlfile until cancel, you have to apply archived logs. Did you apply all of them?
    If the create command was in the online redo, not yet archived, and you lost the online redo, then you won't have it. This is why you want to have redo multiplexed, it is a critical piece.
    In some recovery scenarios, if you haven't lost the online redo, you need to specify those files as if they were archives.
    It is normally easier to just be sure you have the latest controlfiles and let Oracle figure it out automatically (which is why you want to use online RMAN backups rather than cold backups). But yes, it is important to understand what is going on for different scenarios. I used to have manual standbys, and one of the disaster instruction sets explained to try to get online redo over to the standby to lose as few transactions as possible. That could still be useful for some snapshot hardware type scenarios, assuming the business is too cheap to do proper failovers.

  • Need clarification on DNS, Certificate and URL? during 2010 to 2013 migration

    Hi Guys,
    I am working on a migration project Lync server 2010 to 2013.
    Lync 2010 Standard Edition and Edge 
    Lync 2013 Ent edition and Edge  (Enterprise Voice "SIP Trunk")
    I need few clarification on How to setup the DNS, Certificate and URL Pre and post migration?
    Shall we use the Lync 2010 existing internal and external URLs to lync 2013 or do we need to setup a new URLs for lync 2013?
    How about the DNS records and Certificates?
    I have gone trough the below blogs but need clear understanding on this part..
    http://lyncdude.com/2013/08/11/understanding-lync-dns-records-and-autoconfiguration/
    https://technet.microsoft.com/en-us/library/hh690044.aspx
    and few more....
    Thanks,
    Balakrishna G
    Regards, Balgates

    Hi,
    Agree with Thamara.Wijesinghe.
    You need to different Web service URL for Lync Server 2010 and Lync Server 2013. If you only have Web service URL for Lync Server 2010, then Lync 2013 mobile will fail to connect to FE Server. If you point Web service URL point to Lync Server 2013 Pool,
    then both Lync 2010 and 2013 mobile clients will connect to FE Server successfully.
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • Need of datatype, message type and message interface

    hai
    can any one tell me..
    why we need three level heirarchy for a message in XI
    regards,
    Madhav

    Hi Madhav,
    let us recall them by their name and identify their roll.
    Data type : suppose that you want to form a message but that comprises of  many different types of data . as in numeric, string, characters.So at bottom you will have to define datatype.
    Message Type: having defined data type now you want to form a meaningful message and that message can be formed by combining many such different data types in to one message type.
    Message interface : No you have created message type but now that you want to use it some where, then you will have to interface it. So you will hace to define a message interface.
    Vishal
    Please reward with points for useful Help

  • Need information regarding local , foreign and document currency

    Hi All,
      I need to know the difference between local, foreign and document currencies.
    Thanks in advance,
    vinay

    Hi,
    Document currency:
    This is the currency set at the POS for the sales documents. If the POS system is not able to send this currency to head office, the POS currency is used as the document currency.
    Local Currency :
    Local Currency - This is, in most cases, the formal currency of the country. In SAP Business One, all the reports displayed in the local currency, and all the foreign currency transactions are translated automatically to local currency. This way, the local currency is the common denominator for all currencies, which enables balance calculation of multi-currency accounts/business partners.
    Foreign Currency: This currency we will talk mostly in the Financial areas
    http://help.sap.com/saphelp_erp2004/helpdata/EN/a6/004940f0030272e10000000a155106/content.htm
    For More detailss:
    http://www50.sap.com/businessmaps/5CE8CE5FA6854AC984502823ACC3AA62.htm
    Difference In Currency :
    http://www.sap-img.com/financial/explain-the-difference-in-currency.htm
    Regards
    Ram.
    Edited by: Ramakanth Deepak Gandepalli on Dec 9, 2009 11:52 AM

Maybe you are looking for