How can a Collection of Primitive type be a Reference Type ?

Here's the example that i am running:
public class one
     public static void main(String args[])
          int i[] = new int[]{0,1,2,3,4,5};
          int j[] = i;
          j[0]=100;
          System.out.println(i[0]);
}Output:100
So the question is quite a weird one actually which i haven't seen any book explain...
How can a group of int be a reference type ??
please explain.

i and j are both references. They point to objects. In this case, they point to the same object--an array of int.
The fact that the contained elemets are primitives doesn't change the fact that the container is an object. It's just like if you did
class Foo {
  int i1;
  int i2;
  int i3;
}A Foo object is still an object, even though its member variables are all primitives, and Foo foo; is still a reference variable that points to a Foo object, just as i and j are reference variables that point to array objects.

Similar Messages

  • How would you store a primitive type?

    Hello
    How would you store a primitive type in a Collection such as a List?
    Thanks
    Bobby

    <face grin=evil> myList.add(int.class); </face>

  • How can i restrict the Expenditure Type values at a specific OU ?

    Dear Guys,
    I would like to ask about the Expenditure Types,
    I have implemented two projects for different Operating Units ,
    when navigating to any Projects responsibilty,and navigating the Expenditure Type field
    the values exist are all the values implemented across the OU not the values entered at this OU
    How can i restrict the Expenditure Type values at a specific OU
    Regards
    Amr Hussien

    Hello
    When you set up a project there is an option called Transaction Control.
    This option allow you to list the allowed or restricted elements of costs for the project.
    You may enter the transaction control on a project template and that will be copied to any new project.
    The cost elements may be expenditure types, expenditures categories, suppliers, employees, etc.
    In your case, I suggest to set up specific project templates for each operating units. On each template enter the list of allowed expenditures types for that OU.
    Doing so, the system restricts users from entering any expenditure item, supplier invoice, purchase cost etc, against an expenditure type, which is not allowed.
    Dina

  • How can i call a condition type into my ALV report

    I am developing one ALV report in that how can i call a condition type.I am one condition type PB00 for special price.This special price column should be present at the output list.This special price is not there any one of the database tables.So we will create one condition type for this.How can I develop one condition type and how we may call this condition type into my ALV report.

    V/06 is the condition type transaction .You attach a Access sequence to that which is stored in V/07 .
    there you can also get based on key combination tables names .
    which you can used in your report to include in the ALV .
    Contion type PB00 Access sequence PB00
    which will have step say
    Step Table combination 
    1      071       Material plant
    2      142       SO/dc/DV
    here Application would A and table would A table number .
    for eg .A071 .

  • How can prevent duplication of condition types in sales order??

    How can prevent duplication of condition types in sales order.
    While we want Amount field Changeable by user.
    Please give me solution.

    Dear Rohit,
    Can you explain your scenario in detail with an example or any screen shot so that we will help you in easy way ...
    Regards,
    C.B Reddy

  • How can I call a condition type in my ALV report

    I am having one condition type.Then how can I call a condition type in my ALV report.

    Hi,
    If you have any conditions then filter your data according to that conditions through SQl queries.
    And then display it through ALV.
    Regards
    Mudit

  • How can I get network data type

    how can I get network data type: ip, gatway, sub mask, and DNS on the Mac. windwos system and so go on and put cmd ipconfig / all adiquirr how can this data in mac book pro XOS.
    thanks,
    Marcello

    Select  ▹ System Preferences ▹ Network ▹ Advanced ▹ TCP/IP.

  • I connect my pendrive to macbook pro but it cannot detect and my important data is there in my pen drive so how can i collect this data from my pendrive?

    i connect my externalpendrive to macbook pro but it cannot detect and my important data is there in my pen drive so how can i collect this data from my pendrive?

    make sure that in your finder preferences you have it checked to show external drives on the desktop and in the sidebar of finder
    you find these preferences by selecting the finder icon (blue square on the dock w/ smiley face on it) then click on the work "finder" at top left corner of computer screen then click on preferences then general and put check next to show these items on the desktop and put check next to external drives
    now you should see it on the desktop if you still can't open the drive or access it, it may be in format the mac can't read or write to so that could be an issue.

  • HT201272 I bought some tokens to help on 'Words with friends' but they didn't download. I have the receipt for the purchase. How can I collect the tokens?

    I bought some tokens to help on 'Words with friends' but they didn't download. I have the receipt for the purchase. How can I collect the tokens?

    You will never receive a reply from Physios because they have discontinued the game and all support for it.

  • How can i find differnet output types for a given sales order ?

    hi all,
    answer my question please........?
    how can i find differnet output types for a given sales order ?

    hi
    check in NACO transaction if you have assigned access sequence to your output ytpes and if you have ticked checkbox "Access to output conditions" - otherwise it will not even try to access condition records.
    From help :
    Access to output conditions
    Indicates whether the system determines the output by searching for valid
    condition records.
    Procedure
    If you want the system to search condition records for the appropriate
    output, mark the field.
    Note
    If you leave the field blank and if you are processing sales, shipping,
    or billing documents, the system automatically determines output from
    information stored in the customer master record.
    regards
    ravish
    <b>plz reward points if helpful</b>

  • How can we change the valuation type for a material created.

    How can we change the valuation type for a material created.
    Note : All open orders are closed for this material.3
    Please guide

    Hi,
    You can change valuation class, or you can set valuation category for your material master. If valuation category is set you can extend your material master and in this way creating records for different valuation types.
    Please try to set the desired changes in your mmr (MM02) > save > SAP will give you error message > push 'Display error' button and you will see what conditions must be eliminated to carry out the change.
    - you are not allowed to have open transactional data
    - no stock in the current and previous period (using proper posting date in MB1A + 201 you can reduce your stock level to 0, and after that you can set it back by MB1A + 202)
    - in case of valuation category setting batch archiving may be necessary
    BR
    Csaba

  • How can we change the inspection type

    Hi
    Can any one answer my question.... How can we change the inspection type...I think its not possible through BDC and i am not able to find any custom program for LSMW...Any help?
    Thanks,
    Aparna

    Hi
    For indivial material you can change it from MM02 . ( Select Insp.setup under Quality Management view) and again choose for Create new Inspection Type
    For  multiple or mass change MM17
    Edited by: Sanjay  Shah on Feb 19, 2010 10:43 AM

  • How can I see the processor type in my ipad 4

    How can I see the processor type as A6X in my ipad 4

    All iPad 4s have the A6X chip in it - if you type in the iPad's serial number (Settings > General > About > Serial Number) in on this page then that will confirm whether it's an iPad 4

  • Hey i have a iphone 4s 64gb but and using the internet share .. how can i change the nat type from strict to open please help me :)

    hey i have a iphone 4s 64gb but and using the internet share .. how can i change the nat type from strict to open please help me

    You will have to configure that with your router. Type your router's IP address in the search/domain bar and allow port forwarding.
    What is requiring you to have an open NAT? That issue is usually for gaming consoles, etc.

  • How can I reset the font type and size on my email. It changed after I updated to Firefox 5.0 and I can't get it back.

    After updating to Firefox 5.0 the font changed on my email. I checked, and the default setting is what I had put in before the update but it's not working. How can I get my email to use the font and type size that I chose? The one that's currently being used (since after the update) is so tiny one can hardly see it. My email program is through yahoo but there doesn't seem to be a way to change it at the email site. I'm not terribly PC savvy so please respond with a detailed/explicit answer. Thanks for any help you can give me with this. I have Windows XP and use Firefox as my browser.

    Hi again...,,yes, I did try the "reset zoom" on the email compose message page and nothing happened. I'm not familiar with add-ons. Went to the address you suggested (DefaultFullZoomLevel) but don't know how to use it. Also, I don't want to enlarge the text on all web pages.....just the email page. By the way, if it makes a difference, I think I forgot to mention that I use AT&T/Yahoo webmail....not Outlook Express or Thunderbird or any other email program. I'm not familiar with those and don't want to change email programs. Thanks again for trying to help with this. I'm beginning to think this problem is "unfixable" and considering changing back to a previous edition of Firefox (IF that's even possible).

Maybe you are looking for