Different results with the same character array.. help me to find out why..

Hi,
The following code is giving some unexpected results can anyone explain it...
*public class A1{*
     public static void main(String[] args)
          char[] a = {'1','2','3','4'};
          System.out.println(a);
System.out.println(a+"")
The Result is :
*1234*
*(some address of array)*
Can anyone tell me why it happens that same aray is giving one time the string value and one time an address....
Edited by: Shenshah on Jun 12, 2008 3:23 AM

If you look at the API docs you will see that PrintStream has multiple println methods.
Each of your println calls invokes different one.
System.out.println(a);calls println(char[]) which according to the docs prints the characters in the array.. ("abcd" in this case)
System.out.println(a+"") calls println(String). concatenating the empty string to a causes a.toString() to be invoked and the "address info" that you see is the result of that toString() call.

Similar Messages

  • Drawing images gives 2 different results with the same code.

    Im adding my code on here, and its sort of long but ill try to explain it. Most of it you can ignore.
    Anyway i'm making a tree menu with only 1 level of expansion. So you have a TreeMenu object, and this object has some Branch classes. These Branch classes have Leaf classes. That is all. On the menu there is also a little box where you can click to expand and collapse each branch. if a branch is expanded, all of its leaves are shown. if it is collapsed only the branch name is shown.
    So far what I've described above works, there is a small scale compilable working program, that is alright. Theres just a few bugs to fix.
    A little feature of the tree is if a branch or a leaf is selected (has been clicked on in the past) it has a blue background. This sort of works. The branch names seem to work alright, and some of the leaves. However other if you run the example i provided you can click on Leaf 1, and it will be ok, but if you click on Leaf 2 then there blue background is twice as big as it should be. But for the rest, it works ok.
    This is weird to me because the same code handles any of these same situations. So it seems that i get 2 diferent results with the same code. If anyone would like to help heres some stuff you should know:
    You can ignore Leaf class, i dont think theres any errors in there.
    You can ignore just about all of Branch class except the update() method.
    You can ignore all of TreeMenu class except the inner MouseListener class might be useful.
    You can ignore TreeTester. Just the JFrame tester class.
    to run the code:
    javac TreeMenu.java
    java TreeMenu
    http://cs.ucsb.edu/~jsterling/treemenu.zip
    thanks.

    You make a good point Stefan but unfortunately I already checked that.  I have even copied the mapping (right click copy) and pasted it from the working Mapping to the bad Map (Paste) to make sure the context values were all the same.
    I also opened all the queues and compared the values in each.  All values match exactly except for the result(out) queue.
    In both tests I am using the same IDOC XML file. 
    These are the only differences I see.
    1.  The IDOC is exactly the same as far as I can tell but they come from two different source SWCV.  SAP APPL 4.7 and Steelcase_Procurement (ECC 6.0). 
    2.  The working map uses a local UDF.  The bad map calls the UDF from a Function Group.  Is there a Java version difference between the two?
    A better sample of the result queues look like this:
    Correct Result:
    Thickness of Glass: 20
    Height: 10
    Width: 5
    Length: 18
    Thickness of Glass: 10
    Height: 15
    Width: 8
    Length: 14
    Bad Result:
    Thickness of Glass: 20
    <null>
    <null>
    <null>
    Width: 5
    <null>
    <null>
    <null>
    I took this chance to redesign my Variant Config output to separate the characteristics/values, but I'm still bothered that I was unable to determine what would cause the differing values.
    Any ideas?
    Thanks,
    Matt

  • UDF has 2 different results with the same input

    Hello,
    I have two mappings of the ORDERS idoc.  In both mappings I use the following UDF function to create a long string output:
    public void matConfig(String[] CHAR, String[] CHARTXT, String[] VALUE, String[] VALUETXT, String[] POSEX, String[] LINE, ResultList result, Container container) throws StreamTransformationException{
    int i, j;
    String crlf = "\r\n";
    StringBuffer matConfig;
    j = 0;
    for (i = 0; i < POSEX.length; i++) {
      matConfig = new StringBuffer();
      while (LINE.length > j && Integer.parseInt(POSEX<i>) == Integer.parseInt(LINE[j])) {
        if (matConfig.length() > 0)
          matConfig.append(crlf);
        if ((CHARTXT[j].length() > 0) || (CHAR[j].length() > 0)) {
          if (CHARTXT[j].length() > 0)
            matConfig.append(CHARTXT[j]);
          else
            matConfig.append(CHAR[j]);
          matConfig.append(" : ");
          if (VALUETXT<i>.length() > 0)
            matConfig.append(VALUETXT[j]);
          else
            matConfig.append(VALUE[j]);
          j++;        
      result.addValue(matConfig.toString());     
      result.addContextChange();
    I have checked the queues of all the inbound fields and the values match exactly but in one mapping the output in the queue for this UDF looks like this:
    Correct Result:
    Thickness of Glass: 20 Height: 10 Width: 5 Length: 18
    Thickness of Glass: 10 Height: 15 Width: 8 Length: 14
    Bad Result:
    Thickness of Glass: 20
    Width: 5
    How can the same input using the same java code (cut and pasted to make sure it matched) return 2 different values.  I have verified that they both use the same Imports as well.  The bad one is part of a function library while the good one is a local function. 
    Any ideas?
    Thanks,
    Matt
    Edited by: Matthew Herbert on May 29, 2010 12:09 AM

    You make a good point Stefan but unfortunately I already checked that.  I have even copied the mapping (right click copy) and pasted it from the working Mapping to the bad Map (Paste) to make sure the context values were all the same.
    I also opened all the queues and compared the values in each.  All values match exactly except for the result(out) queue.
    In both tests I am using the same IDOC XML file. 
    These are the only differences I see.
    1.  The IDOC is exactly the same as far as I can tell but they come from two different source SWCV.  SAP APPL 4.7 and Steelcase_Procurement (ECC 6.0). 
    2.  The working map uses a local UDF.  The bad map calls the UDF from a Function Group.  Is there a Java version difference between the two?
    A better sample of the result queues look like this:
    Correct Result:
    Thickness of Glass: 20
    Height: 10
    Width: 5
    Length: 18
    Thickness of Glass: 10
    Height: 15
    Width: 8
    Length: 14
    Bad Result:
    Thickness of Glass: 20
    <null>
    <null>
    <null>
    Width: 5
    <null>
    <null>
    <null>
    I took this chance to redesign my Variant Config output to separate the characteristics/values, but I'm still bothered that I was unable to determine what would cause the differing values.
    Any ideas?
    Thanks,
    Matt

  • Two very different results using the same settings (H.264 / Quicktime Pro)

    I’m a bit confused, I have used Quicktime Pro (v7.1) to encode DV into H.264 for iPod and this particular video is 18 minutes long and came out looking very good with the following settings;
    VIDEO: H.264 at 200kbps, Baseline Profile, 25fps, Auto Key Frames, 320x240 or 640x480, Multipass Best quality encoding.
    AUDIO: AAC Audio at 96kbps, 24kHz sampling freq, Stereo.
    However here is the twist…
    When I use the same exact settings to encode just the 30 second opener (from the 18 minute video) the encoded opener looks bad and blocky!
    Why? Same settings would make you assume that you should get a same or similar result, or am I wrong?
    The reason I have tried encoding this 30 second opener is that I am trying to work out which settings work best on the iPod (another issue) and I don’t want to spend hours test encoding the full 18 minute video, as you know H.264 is SLOW to encode!
    So can anyone help in regard to two very different results using the same settings?
    Regards,
    J
    PC   Windows XP  

    Alvin,
    Is it a commercially-released or home-burned CD?
    If it's commercially-released, try "encouraging" the recalcitrant computer by using the iTunes Advanced menu > Get CD Track Names command when it shows Audio CD.
    If it's home-burned, you will find that only the computer that actually burned the disc will know what's on it. The information won't be transferred to another computer.
    Let us know which, if either, of these situations applies to you.

  • My iPhone is merging different contacts with the same firstname into one contact. How can i resolve this.

    My Bosses iPhone is merging different contacts with the same firstname into one contact. How can i resolve this? He seems very disturbed and thinks i don't know what i'm doing. I've set up all his devices to sync across and now its messed up on his iPad, and two iPhones.
    E.G Contacts with firstname 'Adams' and different numbers are synced into one account.
    Now i have no clue how many contacts are this way cos he has a huge number of contacts (he's the ceo).
    Please i need a suggestion on how to fix this.
    Thanks for the help.

    Janie Mac wrote:
    Cannot find settings to then go to general then about.
    How do I edit the device in iTunes?
    Double-click on the name.
    My screen shot shows both devices because I sync wirelessly.  Right now I can change the iPod name but not the iPad name because the iPod is idle while the iPad is syncing.  In another minute or two, I'll be able to change the iPad name.

  • Publish two publications from different customers with the same Adobe DPS ID

    Hello:
    I have a publication made on InDesign and I have uploaded it to the Adobe Server with my Adobe DPS account. For the first publication, I published the publication with the Folio Producer on the digitalpublishing portal, and then I created the app using the Adobe Viewer Builder. Then, I tried it locally on my iPad. It was working fine and I could see my publication.
    Now, I do need to upload a new publication for a different customer with the same Adobe DPS account and I need to create a different app with the new customer look and feel but I don't want to show the first publication in this new app, only the last one.
    In a nushell, I need to keep separated two publications (or more) when they are published if I'm using the same DPS Account... Is that possible?
    Saludos Cordiales,

    Hi Leo,
    Every title should have its own publication AdobeID (a title can contain multiple editions / folios).
    So you have to request for every title you want to work on a provisioned account with Adobe. Make sure that you have setup the corresponding emailaddress / emailalias. For example [email protected] and [email protected]
    After the accounts have been provisioned you can:
    * upload and organize multiple folios for that publication in the corresponding Folio Producer
    * Create a viewer with your Viewer Builder and on the first page supply the AdobeID for the give publication
    You can request new publication accounts any time and these are included with your DPS subscription.
    When you first account got provisioned, you should have received an excel document to request provisioning for the various publications. In this document you can list the accounts you want to use for publications, individual users of the system and viewer builder access.
    With kind regards,
    Klaasjan Tukker
    Adobe Systems Benelux

  • My Ipod classic has started to play mono only through the headphones. I have tried different headphones with the same outcome. Is the device repairable or better to upgrade?

    My Ipod classic has started to play mono only through the headphones. I have tried different headphones with the same outcome. Is the device repairable or better to upgrade?

    Hey Grimeymouse, 
    Thank you for contributing to the Apple Support Communities. 
    It sounds like your iPod classic is only playing sound in mono when using multiple headphones. 
    Since you've likely isolated this behavior to the iPod by trying multiple headphones, see this advice from the "The headphones don't work" section of the iPod troubleshooting basics and service FAQ: 
    If the issue appears to be with the iPod, try resetting it. If that doesn't work, then restore iPod with the latest iPod software using iTunes 7 or later.
    All the best,
    Jeremy 

  • How to force OSX to connect to a specific Access Point i.e. manually choosing beetween different APs with the same SSID?

    My office room is near different APs with the same SSID, my Snow Leopard selects automatically to join the AP with stronger signal.
    But this AP isn't running well, so I want to force my mac to join a AP with weaker signal.
    (I've the same troubel as described in https://discussions.apple.com/message/6470508#6470508)
    Note that I'm a guest user and I hanen't access to APs, so I cannot change their SSID.
    Any idea how to force Mac to join a specific AP?
    Thanks,
    adso

    My office room is near different APs with the same SSID, my Snow Leopard selects automatically to join the AP with stronger signal.
    But this AP isn't running well, so I want to force my mac to join a AP with weaker signal.
    (I've the same troubel as described in https://discussions.apple.com/message/6470508#6470508)
    Note that I'm a guest user and I hanen't access to APs, so I cannot change their SSID.
    Any idea how to force Mac to join a specific AP?
    Thanks,
    adso

  • When mac email changed to icloud a while ago i lost all my emails and things i have an email subscription to send emails but they do not reach the email that i updated with the same address any help?

    When mac email changed to icloud a while ago i lost all my emails and things i have an email subscription to send emails but they do not reach the email that i updated with the same address any help?

    If you purchased about 2 years ago new I am sure it is a Intel iMac. To find out what type of iMac you have just click on the Apple menu item in the finder and select about this Mac. I would check the ISP mail site and get the correct outgoing mail server info.   

  • I have an iPod touch that is synced with my library.  I just got a new Nano and I want to sync that with the same library but I can't figure out to do it with iTunes 11

    I have an iPod touch that is synced with my library.  I just got a new Nano and I want to sync that with the same library but I can't figure out to do it with iTunes 11

    I watched the new itunes tutorial, and if you double click on the  blank part of the bar that says music, videos, apps, etc, a button will show with your ipod's name.

  • How can you find out if another VI running on the same computer and how can you find out the name of that VI?

    Suppose that several VIs running simultaneously on the same computer. How can I find out the names of the running VIs, from another VI?
    If the already running VIs are clones of the same basic VI, open and run with the option "Prepare to call and forget", how can I find out the names and index of each clone? 

    I had an application where I spawned (= ran with Start Asynchronous Call) multiple (reentrant) copies of VIs, and would occasionally "lose control" of them.  I needed a way to find all VIs that were running "Top Level" and stop them (so I didn't have to log off from Windows).
    I used the Application Property "All VIs in Memory" to get an array of (wait for it ...) All VIs in Memory.  I took each name, opened a VI reference to it (simply wire the name string in, as the VI is, by definition, "in memory"), looked at its VI Execution State, and if it was Run Top Level, Invoked the FP.Close and Abort VI Methods.  [To prevent the VI that did all this from "committing Suicide", I compared the name string with the current Call Chain, and did nothing if there was a match].
    I think you could adopt this idea to do what you need.
    BS

  • Different Risk Analysis Results with the same user from 2 different RAR

    Hi..
    I've loaded the same Risks, Rules, etc, into 2 GRC RAR environments (Sandbox and Quality systems); both of them are connected with the same SAP ECC system. But when I do a User Risk analysis (authorization level), the result from Sandbox is different from Quality system. I donu2019t have users or roles mitigated yet, users are synchronized, rules are exactly the same and I donu2019t know what happen??... Please, help me.
    Thanks...

    Hi...
    If I do a Full Sync of users to the same ECC system from both RAR boxes, I got different number of users loaded (i.e. 18757 vs. 18141), similar case with the full sync of roles. (13100 vs.  13150).
    If I load exactly the same set of functions to both RAR systems and I generate the rules, I got the same problem, different number of rules is generated.
    I've verified both RAR configuration and they are the same (excluded users, roles mitigated, etc.)
    Is it a normal behavior? What could be wrong?
    Thanks in advance!!

  • My magic mouse won't connect to Yosemite 10.10.2 I've tried 2 different mice with the same outcome.

    I have an early 2013 MBP with Yosemite 10.10.2. Connectivity with the magic mouse has steadily gotten worse, now it won't connect at all. I've tried connecting with two different mice, one about 5 years old and one about 2 years old, both with the same result. Any one else have this issue?

    Hello rachste,
    I'm sorry to hear you are having these mouse issues with your MacBook Pro. If you continue to have connectivity issues with your Bluetooth mice, you may find the information and troubleshooting steps outlined in the following article helpful (apologies if you have already seen it):
    Troubleshooting wireless mouse and keyboard issues - Apple Support
    Sincerely,
    - Brenden

  • Itunes match with two different libraries on two different computers with the same apple ID? How?

    I have a work PC that I synch with my itunes library and it works totally fine. I also have a macbook at home with a different library on it. Both compuers share the same apple id. will itunes match synch all the devices with the same library? If so do I only need one itunes match purchase or do I need one for each computer? The apple help desk (phone support) and apple store I recently visited were unable to provide me with answers to my questions.

    Just create a new account. On one iPod go to Settings>iTunes and App stores and sing out and sign in with other account. Same for Settings>iCloud and Settings Messages. Also go to Settings>Face time and add the new iD email addrss as the Caling email address and delete the other one.
    - Apps are locked to the account that purchased them.
    - To update apps you have to sign into the account that purchased the apps. If you have apps that need updating purchased from more than one account you have to update them one at a time until the remaining apps were purchased from one account.

  • WPC: unable to add different resources with the same name into a WPC page

    Hi,
    I got a WPC problem when adding different KM resources with the same name into a WPC page.  Only one KM resource is able to be added in WPC.
    For example:
    There two "article.html" with different content and RID:
    1. /company_a/article.html
    2. /company_b/article.html
    when adding these two html pages into a WPC page, only one page will be shown.
    This means that a WPC page is not able to contain resources with same file names.  I think the problem might lie on the resource-linking mechanism of WPC. WPC will add a resource link in the page folder, when a new resource is drag&dropped into WPC.
    Anyone has some good ideas to solve my problem? Thanks a lot.
    Regards
    Lei NING
    Edited by: Lei NING on Apr 15, 2008 4:16 PM

    As this is not possible and double entries cause this problem, why not just pu both napes in the contact details on the same number. IE John Smith & Peter Jones all in the first name, by doing this if you search your contacts either by searching for john, peter, smith or jones the number will show up and if either calls the number will show John Smith & Peter Jones, it may not be perfect but will work. As the phone only recognises a number if two seperate entries of the number exist with different names it cannot possibly know who is calling ?
    If I have helped at all, a click on the White Star is always appreciated :
    you can also help others by marking 'accept as solution' 

Maybe you are looking for

  • Bought a macbook aluminum

    I've got a couple questions regarding this new macbook: So I bought it used off of someone from craigslist. It's in pretty good shape, but missing a handful of screws (all the screws on the inside, once the bottom plate is taken off, 4 in total... an

  • Exporting files

    the senario is tht I need to move a unix file from the unix based web/app server to windows system... I am using content dispostion for this purpose, i am readin the file from the unix location and creating the same file on windows location, the jsp

  • ActiveX in Forms

    Does anyone have any experience with calling ActiveX controls from Forms 6i (on web)? Zeljko Djuricic

  • How to setting in the onetime vendor and customer in AP/AR

    Hi how to create onetime vendor /customer in AP/AR .which t code can be used in posting and where the  vendor master level data filling and address and vendor name yps

  • Extract Time in Date Datatype

    Hi Guys, I am running the below query: select to_char(sysdate,'hh24:mi:ss') from dual 14:39:04 select to_date(to_char(sysdate,'hh24:mi:ss'),'hh24:mi:ss') from dual 01/07/2012 14:39:40Is is possibile to just get the time part in date datatype i.e anyh