Trouble displaying array contents

I have a class that generates random coin values (int) and then another class to assign the random coin values to an array, but when i attempt to display the array contents I get stuff like "Coin value is HOTcoin@18d107f" instead of a simple integer.
          HOTcoin[] coins = new HOTcoin[8];          
          for(int i = 0; i < coins.length; i++) {
                    coins[i] = new HOTcoin();     
                    System.out.println("Coin value is " + coins);
I'm sure it's something simple. Can someone help me out?
Thanks..

How should it know that when you "print" a HOTcoin object that the representation should just be a number, unless you tell it to do that?
You need to override the toString() method in the HOTcoin class.

Similar Messages

  • Display array contents & prompt user for process priority

    Hi, i need help developing an interface.
    I have an array which contains a complete list of models available at my company. Now, i want to create an interface where the contents are displayed and user is able enter numbers to select the models he/she wants to run and the process priority.
    eg: The array contains models A to Z. The user is able to select models D, A, G and B and instruct the program to process them at the same sequence.
    How do i acheive this in Labview?
    I'm very poor at designing interface, can someone point me to any literature and tutorials in developing frontpanel interface in Labview?
    Thank you.

    Hey, I have done something similar to this in the past.  The way I did it was by using a listbox.  I had buttons that the user would select to tell me what to do and how to modify the listbox contents.  For example, in your case, I would have an Edit button.  When the user selects the Model and hits Edit, I would pop up a screen asking him which process he would like to assign to the model.  Then I would check for errors and if none existed, I would update the listbox contents with the new information.
    Let me know if this helps or if I should provide more explantation.
    Thanks!
    Dan
    Daniel Eaton
    National Instruments
    Systems Engineering
    Embedded and Industrial Control

  • Displaying the contents of an array of objects

    Hello All,
    My Java teacher gave us a challenge and I'm stumped. The teacher wants us to display the contents of the array in the main menthod. The original code is as follows:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    }I understand that the elements of the array are objects, and each one has a value assigned to it. The following code was my first attempt at a solution:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
                                    for ( int i = 0; i < thingArray.length; i++)
                                       System.out.println( thingArray );                         
    }To which I'm given what amounts to garbage output. I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array. There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. Thanks very much in advance!

    robrom78 wrote:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    for ( int i = 0; i < thingArray.length; i++)
    System.out.println( thingArray );                         
    Note that you're trying to print the entire array at every loop iteration. That's probably not what you meant to do.
    You probably meant to do something more like
                                 System.out.println( thingArray[i] );Also, note that the java.util.Arrays class has a toString method that might be useful.
    To which I'm given what amounts to garbage output. It's not garbage. It's the default output to toString() for arrays, which is in fact the toString() defined for java.lang.Object (and inherited by arrays).
    I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array.It displays a default result that is vaguely related to the memory, but probably shouldn't be thought of us such. Think of it as identifying the type of object, and a value that differentiates it from other objects of the same type.
    By the way I assume you mean "+not+ the contents of the array" above. If so, that is correct.
    There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? No, you don't override a method in println; actually methods don't contain other methods directly. You probably do need to override toString in Thing.
    I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. You can get to the individual objects in the array just by dereferencing it, as I showed you above.
    But I suspect that won't be sufficient. Most likely, Thing doesn't have a toString method defined. This means that you'll end up with very similar output, but it will say "Thing" instead of "[Thing" and the numbers to the right of the "@" will be different.
    You'll need to override the toString() method in Thing to get the output you want.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to display the contents of an array list to a listview?

    Hi. How do I display the contents of an arraylist to a listview?
    Here is my current code:
    var c: Control= new Control();
    var simpleList: ArrayList = c.ListResult; //ListResult is an ArrayList containing strings
    var simpleListView : ListView = ListView {
            translateX: 0
            translateY: 0
            layoutX: 20
            layoutY: 80
            height: 130
            width: 200
            items: bind simpleList;
    Stage {
        title: "Trial app"
        width: 240
        height: 320
        style: StageStyle.TRANSPARENT
        scene: Scene {
            content: [ simpleListView
    } [http://img341.imageshack.us/img341/133/listview.jpg]
    My code generates the result in this screenshot above. It shows that all the contents on the arraylist is displayed in one row/item.
    It should be displayed as (see bottom image) ...
    [http://img707.imageshack.us/img707/3745/listview1.jpg]
    Do you guys have any idea on this? Thank you very much for your replies

    For your listbox data to bind the listbox requires a Sequence. This is something that you can sort out at the entrypoint of your code.
    In the example below I have used an ArrayList to simmulate the data you have entering your FX code, but then I put that list into a Sequence, in your case instead of having an ArrayList in your FX code, you simple supply the list on entry, as I have marked in the following code.
    * Main.fx
    * Created on 12-Feb-2010, 10:24:46
    package uselists;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.text.Text;
    import javafx.scene.text.Font;
    import java.util.ArrayList;
    import javafx.scene.control.ListView;
    import javafx.animation.Timeline;
    import javafx.animation.KeyFrame;
    * @author robert
    //Simmulate your data with an ArrayList
    var simpleList: ArrayList = new ArrayList;
    simpleList.add("Hello");
    simpleList.add("World");
    // *** This is what your entry point would become, just load the simpleList.toArray() into your sequence ***
    var simpleSequence = [];
    simpleSequence = simpleList.toArray();
    //after some time add some items, to show that our binding is working
    Timeline {
        repeatCount: 1
        keyFrames: [
            KeyFrame {
                time: 5s
                canSkip: true
                action: function () {
                    //you can work on the Sequence to add or remove
                    insert "Another item" into simpleSequence;
                    //if you at some point want to have your array reflect the changes
                    //then perform your changes on that too
                    simpleList.add("Another item");
                    //remember depending on your app
                    //you may keep the update of simpleList
                    //until you are finished with this view and do it in a single update
            KeyFrame {
                time: 10s
                action: function () {
                    //Alternatly, to keep your ArrayList correct at all times
                    //add items to it and then update your Sequence
                    simpleList.add("Added to array");
                    simpleSequence = simpleList.toArray();
    }.play();
    Stage {
        title: "Application title"
        scene: Scene {
            width: 250
            height: 80
            content: [
                ListView {
                    items: bind simpleSequence
    }You can bind to a function rather than the data, which I am sure would be needed some cases, for example if the listBox data was a named part of a hash value for example, all that is required is that your function returns a sequence.

  • How to display the contents of a 2D array which is bound to a data table

    Hi ,
    I have a backing bean which returns me a 2D array of Strings . Now I have bound this to a data table .
    Something like this
    <h:dataTable styleClass="dataTable" id="dstable" var="dbArray" value="#{pc_MyApp.dbProperties}">
    Now when I say dbArray[i] it will give me the ith column of the current row. I want to display these dbArray[i] contents in a proper table format.
    What I am doing at present is something like this
    <h:dataTable styleClass="dataTable" id="dstable" var="dbArray" value="#{pc_MyApp.dbProperties}">
    <h:column id=id1>
    <h:facet name="header">
    <h:outputText value="Heading"/>
    </h:facet>
    <h:outputText id="text1" value="#{dbArray[0]}" ></h:outputText>
    <h:outputText id="text1" value="#{dbArray[1]}" ></h:outputText>
    <h:outputText id="text1" value="#{dbArray[2]}" ></h:outputText>
    </h:column>
    </h:dataTable>
    This is able to display the contents of 2D array on the screen, but everything for the current row comes in just a single column...I want each column value to be in diff column and it should look like a table.
    Can anyone please guide me in this respect..
    Thanks
    Mahajan

    Does doArray always have at most three elements?
    If so, you can specify three <h:column>s each displays doArray.

  • Trouble displaying icon on push button in 6i Forms

    Hi,
    I'm having trouble displaying an icon on a button at both design and run times. I'm using Forms 6i with client/server enviornment. I have tried to follow several forums regarding icon setup and the Whitepaper articles. I have tried different suggestions but am still unable to get the icon. Here's my latest attempt:
    1. Copied .jar file to C:\Oracle_Developer_9i\forms90\java folder
    2. Modified formsweb.cfg (in the serverApp=default section) and included the following:
    archive_jini=f90all_jinit.jar,myAppIcons.jar
    imagebase=codebase
    3. In button's properties I set:
    iconic = 'Yes'
    icon filename = C:\Oracle_Developer_9i\forms90\java\myAppIcons.jar
    My guess is that I didn't copy the icon files (from the .jar file) correctly. As suggested in the Whitepaper, I don't have the c:\ myApp\ icons directory. I did a search for an icon directory and found multiple icons folders (due to other oracle projects installed on my pc) but don't know which one to use. Being that I'm using 6i and the instructions were for 9i I didn't know if the directory/folder name is different. Is there another directory/folder (using 6i) where I should copy all the .gif files from in addition to storing the .jar file in the C:\Oracle_Developer_9i\forms90\java directory?
    Also, I feel that I'm not calling it correctly from the location in step 3. Being that the icon exists in the jar file, how would I reference it within the file? Does anybody have any suggestions? Any help would be greatly appreciated.
    Thank you,
    Eric

    Robin,
    I tried your suggestions but am still unable to view the icon. Here's what I now have tried.
    1. I've created UI_ICONS in the windows registry under the form's oracle home and am calling c:\icons from that variable.
    2. In c:\icons, I copied the .jar file's contents (search.gif) into this folder. This is where I may have a problem in addition to my next step in calling the filename. You mentioned in your first post to put my .ICO files there. Should I rename my .gif to .ico? Not sure if I followed you there.
    3. In the button property, I set icon = yes and icon filename = c:\icons\search.gif -- Not sure if I used the right syntax for the filename. I've tried renaming it to .ico and it still does not display.
    Sorry about all the questions but I really appreciate your help. Do you see anything else that I did that may cause it to not display?
    Thanks again,
    Eric

  • Trouble displaying Period Depreciation in query against cube 0FIAA_C02

    Hello,
    I'm quite familiar with writing queries, however and I'm having trouble displaying "Period Depreciation" in a query against cube 0FIAA_C02.
    All charactertistics and most of the the key figure values appear with values displayed in the query....however any key figure that is to be related to "Period Depreciation" displays a zero.
    Any thoughts on how I can display "Period Depreciation" from this cube?
    Jim

    Hi,
    is the field "Period Depreciation" added to the cube or was it already in the business content ?
    If it was added you can check if the value for "Period Depreciation" is correctly filled from within the update rule to the cube.
    regards,
    Raymond Baggen
    Uphantis bv

  • How to display the contents of the database values which are retrived.

    how to display the contents of the database values which are retrived in servlets and i am able to display the contents in the servlets and if forward to jsp using requestdespatcher,the values are to be shown in jsp one below the other.please suggest me in these........the servlet code is as shown
    while(rs.next()){
                        buffer.append(rs.getString(1));
                        buffer.append(rs.getString(2));
                        buffer.append(rs.getString(3));
                        buffer.append(rs.getString(4));
                        buffer.append(rs.getString(5));
                        buffer.append(rs.getString(6));
                        buffer.append(rs.getString(7));
                        buffer.append(rs.getString(8));
                        buffer.append(rs.getString(9));
                        buffer.append(rs.getString(10));
                        request.setAttribute("result1",buffer);
                        RequestDispatcher rq=request.getRequestDispatcher("/results.jsp");
                        rq.forward(request,response);
    in jsp iam using the getAttribute to retrieve the values as shown
    <% StringBuffer sb=(StringBuffer)request.getAttribute("result1"); %>
    <%= sb %>
    but getting the results in the stretch,i need to display the result one below the other.

    if you load it all into the buffer that is going to be very difficult. I would suggest loading it into some sort of collection. I like using an ArrayList.
    Then pass the arraylist.
    you will then on the jsp iterate through the arrayList using what every you want.. el, logic tags, scriplets.
    so something like
    ArrayList arrayList = new ArrayList();
    while(rs.next()){
    arrayList.append(rs.getString(1));
    //or possibly an arrayList of String arrays
    //maybe using nested for loops.  Inner for loop adds result to string[] then //outer adds string[] to arrayList.
    //can be done any number of ways based on your expected result set.

  • Displaying Array values in Details section

    Hi All,
    I am having trouble with Arrays in Crystal Reports.
    I have made a Shared string array in my main report and am using the same in a sub report. In the sub report I need to print the values in the array one below another like a table.
    Say the array MyArray has values (INDIA, USA, CHINA, JAPAN, UK)
    Right now I have made a formula in which I iterate through each of them and use Join(MyArray[i], ChrW(10))
    ChrW(10) as you might know is used to make a new line. So the formula output essentially looks like the way I want it, that is
    INDIA
    USA
    CHINA
    JAPAN
    UK
    But its still a formula and acts like a single cell. If I export it into Excel, all the values will come in single cell. Moreover, When I use it like this, I cannot do proper formatting on it either.
    Is there any way to make Array behave like a table and use the same in Detail section. I do not want to hit the DB again for this purpose.
    Thanks

    Hi Antony,
    The only way to display the values on the Detail section is to 'get those values from the database'.
    Instead of using a shared array variable, use a comma separated string. Here's what you need to do:
    1) In the Main Report, open your existing shared variable formula and add a new variable:
    shared stringvar array <exisiting variable name>;
    stringvar new_variable;
    existing code line 1
    existing code line 2
    existing code line 3
    new_variable = Join(array_variable_name, ",");
    2) Right-click the Subreport > Select change Subreport Links > Move the above formula to the pane on the right > Uncheck the option at the bottom right that says 'Select data in Subreport based on field'.
    3) Get into the Subreport and use this as the Record Selection Formula:
    {database_field} IN Split({@Pm-formula_name}, ",") //Replace {@Pm-formula_name} with the parameter name that is automatically created in the Subreport.
    -Abhilash

  • How do I display the contents of a folder?

    I am creating a technical resource CD including many
    different kinds of media.
    One such area is support files. These are several files that
    customer might want to copy to a directory on there hardrive. I do
    not want them to have to click on and save each file.
    I have added a folder and files in the baggage file area.
    How do I create a Hyperlink (or some other kind of object)
    that when clicked on lauches Explorer displaying the contents of
    the baggage folder? It does not matter if it is a frame or if its a
    pop-up.
    Any help would be greatly appreciated.

    Here's a thought:
    You want the user to see a directory -- i.e., Contents -- of
    the separate volume, and you're looking for a way to open Windows
    Explorer.
    I would merge everything into a WebHelp package or CHM on the
    CD. The main TOC functions as a substitute for the Windows
    directory tree.
    I guess you don't want to go to the trouble of merging all
    that stuff into a WebHelp or chm package.
    Rather than trying to open a directory in Windows Explorer,
    open a new browser window with a single .htm file showing text
    links that mirror the Windows explorer directory.
    To keep it simple, you could list folder names and indent the
    contents, simulating an expanded TOC.
    Make it more complicated by having one htm file with all
    directories closed, and another file for each directory, expanded
    to show contents. A "back" link, in effect, goes up the directory
    tree. For a little more trouble, if you have, say, six
    sub-directories, make their surrogate TOC pages identical, with
    closed directories, except the relevant one is expanded. Clicking
    the base of another "folder" is, in effect, going up the tree.
    How you distinguish between a CD holding the bonus material
    vs. a directory on the hard drive, I'm not sure. Maybe the original
    link would have an option: Go to the bonus on a CD, or go to the
    bonus on the local drive.
    Perhaps it's not what you're looking for, or too much
    trouble. Just tossing out an idea that you could refine or reject.
    Harvey

  • Swing display array to GUI

    Hi all,
    I am trying to use swing to display the contents of an array in a GUI pane. The gui doesnt need any buttons ( an OK button wouldnt be a bad thing) but I just need it to take the array and display it with formatting.
    I have the program so far to display the array in console with the proper formatting. The array is a multi attrib array so it has strings, ints, and doubles.
    So I need to use the format already in place to display the array but instead of console, just display it as a swing GUI.
    I can post my code later, if anyone has ideas on the best way to accomplish this, i would appreciate it!
    Thanks

    If it's just an array, a JList springs to mind. If it were a tree, then use JTree. Etc.
    Look at tutorials for javax.swing.JList.
    Swing-specific questions should probably go on the Swing forum.

  • Displaying the contents of internal table- in email Step of workflows

    Hello Folks,
    I wanted to display the contents of an internal table ( would contain a list of opportunites ), in an email sent throught the workflow:
    My idea was to LOOP AT <ITAB> into <WA> from an external program and then call the workflow for each content of the <WA>. This will be a problem as, if there are like 1000 records in the internal table, then workflows will be called 1000 times...sending 1000 emails..
    My requirement is that we need to send a single email to the single person, displaying the content of the internal table in the email body......
    My question
    1) Is this scenario possible through worflows ?
    2) If not, please provide an alternative ..
    Thanks
    Anand

    Do you mean to say that just by inserting the multiline element
    within the body of the 'Send email' step type, the contents
    of the multiline element is displayed automatically without
    we having to loop at it somehow ?
    Follow the below apporach,
    1. First create a multiline container element in the workflow conatiner.
    2. Populate the internla table , by using the bor methods and pass back the populated ITAB to the WF by using the binding concept.
    3. Now create a mail step in the workflow, you have the option of inserting the workflow container elements into the mail conten, so insert the multiline container element , then it prompts to select the option like a) Do you liek to display only first line b) Display the ITAB line by line c) Display ITAB lines continuously with out line break.
    4. based upon the requirement select any one of the options.
    Note: Make sure the line length of the ITAB won't excced 132 charecters, because the send mail step will consider only 132 characters.

  • Displaying the content of one JPanel in an other as a scaled image

    Hi,
    I'd like to display the content of one JPanel scaled in a second JPanel.
    The first JPanel holds a graph that could be edited in this JPanel. But unfortunately the graph is usually to big to have a full overview over the whole graph and is embeded in a JScrollPanel. So the second JPanel should be some kind of an overview window that shows the whole graph scaled to fit to this window and some kind of outline around the current section displayed by the JScrollPanel. How could I do this?
    Many thanks in advance.
    Best,
    Marc.

    Hi,
    I'd like to display the content of one JPanel scaled
    in a second JPanel.
    The first JPanel holds a graph that could be edited
    in this JPanel. But unfortunately the graph is
    usually to big to have a full overview over the whole
    graph and is embeded in a JScrollPanel. So the second
    JPanel should be some kind of an overview window that
    shows the whole graph scaled to fit to this window
    and some kind of outline around the current section
    displayed by the JScrollPanel. How could I do this?
    Many thanks in advance.
    Best,
    Marc.if panel1 is the graph and panel2 is the overview, override the paintComponent method in panel2 with this
    public void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.scale(...,...);
    panel1.paint(g2);
    }

  • I have to keep going back to utilities first aid and do a disck permission repair because my monitor keeps going to sleep. this is  the message i get.Permissions differ on "System/Library/PreferencePanes/.Displays/V1/Displays.prefPane/Contents/Resourc es/

    I have to keep going to disk repair to correct an issue that makes my monitor go to sleep the message i get is
    Permissions differ on “System/Library/PreferencePanes/.Displays/V1/Displays.prefPane/Contents/Resourc es/pt.lproj/DisplaysPref.nib”; should be -rw-r--r-- ; they are -rwxr-xr-x .

    Have you done a PRAM reset, CMD+Option+p+r...
    http://support.apple.com/kb/HT1379
    In fact, do 3 in a row, takes a bit of time.
    Intel-based Macs: Resetting the System Management Controller (SMC)...
    http://support.apple.com/kb/HT3964

  • Is it possible to display the content of complex mutlidimensional datastructures (e.g. std::vectors (dim = 2) of (non-primitive) types) in Xcode debugger?

    Hi,
    First, let me say that I like Xcode and coding in OS X. However, there is something I miss:
    Let me demonstrate what i mean:
    This is the representation of a 2D-Vector in Xcode Debugging environment:
    v          'std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >'          [{...}]
    0          'std::vector<int, std::allocator<int> >'          [{...}]
    1          'std::vector<int, std::allocator<int> >'          [{...}]
    2          'std::vector<int, std::allocator<int> >'          [{...}]
    3          'std::vector<int, std::allocator<int> >'          [{...}]
    4          'std::vector<int, std::allocator<int> >'          [{...}]
    5          'std::vector<int, std::allocator<int> >'          [{...}]
    6          'std::vector<int, std::allocator<int> >'          [{...}]
    7          'std::vector<int, std::allocator<int> >'          [{...}]
    8          'std::vector<int, std::allocator<int> >'          [{...}]
    So, the above representation is what I would call bad (even useless).
    The problem is that the current Linux Kernel (3.1.1) has some problems with the new MBA 2011 (which is really sad) so I can not show you the representation of a 2D-Vector in Qt-Creator for Linux right now (I'm not sure if the Qt-Creator for OS X could display the content properly, since I've never tried it). But you can believe me, that the represantation would look something like the one in Eclipse (which would be a good representation).
    So my question: is there a "fix" for this?

    What you want is a custom data formatter. I would give you some links, but my iPad wants to convert them into the documentation viewer.
    You aren't going to find much help with C++ debugging. While Apple's Clang has made great improvements in C++ support compared to GCC, C++ is really not something that Mac or iOS programmers typically use. The Cocoa containers and objects are so much more versatile. You kind of have to have a masochist streak and a 7 year development schedule to use C++. C++ is experiencing a bit of a resurgence, especially in defense markets. For a long time, compilers had such poor support for C++ that it just wasn't possible. After simplifying the language a little, compilers can now compile and link C++. Consultants have realized they can provide C++ services and burn though billable hours better than any other language on the market. Independent developer, however, don't have those schedules and budgets so they tend to use NSArray. Xcode supports it better in the debugg and, chances are, you don't need to debug it anyway. There are a number of matrix classes built on Cocoa.

Maybe you are looking for

  • Embedded spaces in words

    I am using Adobe Reader Version 9.4.5.  When I select, copy and paste certain content from a pdf file into another tool, say MSWord, Outlook, or even into Adobe Reader's seach box, the words sometimes include embedded spaces.  For example, the word "

  • XI development hours foresee

    Hi people, Do you know a method for project hours preview for XI development based in the kind and complexity of interface to be developed? Thanks!

  • How to turn off unified buffer caching

    It's clear from many other forums that the unified buffer cache is supposed to 'just work' and in general it does. However, I have a situation where I really want the option of turning off caching either at the device or file system level. Is this po

  • Cannot setup email on C7 with Belle

    Hello, I recently updated my C7 to Belle and when I try to create an email account for my yahoo account, the only type of email that is proposed to me is Exchange ActiveSync. How can I create an email account to access my yahoo emails?

  • Dynamically make screen enhancement on or off

    Hi all, I have 2 queries on screen enhancement related to PO transaction. a) I have to add a sub-screen as screen enhancement to Purchase order header area. My requirement is make a the sub-screen visible based on condition that if the PO order is of