Outputting an Array

Ive created an array in my program with 3 values. Im stuck as i have to output a specific value from the array, say value 2 to a text display on my GUI.
Ive tried but i cant figure it out. Can anyone help me?
Cheers

Thanks, getting there.
I just get an error now :(
---------- javac ----------
IVA3ArraysVersion.java:509: cannot find symbol
symbol  : variable temps
location: class IVA3ArraysVersion
          display.setText(String.valueOf(temps[1]));     
                                               ^
1 error
Output completed (1 sec consumed) - Normal TerminationMaybe im setting up the array wrong.
This is all the code that i have done for the array.
     //Data
     int [] temps= new int [3];     
     temps[0] = 2;
     temps[1] = 4;       
     temps[2] = 2;
     // save array
     try
          fos = new FileOutputStream("temps.dat");
          oos = new ObjectOutputStream(fos);
          oos.writeObject(temps); 
          oos.flush();
          oos.close();
          catch(IOException ex)
          System.out.println("error writing: " + ex.getMessage());
     // load and print array
     try
          fis = new FileInputStream("temps.dat");
          ois = new ObjectInputStream(fis);
          int[] temps2 = (int [])ois.readObject();               
          ois.close();                    
          catch(IOException ex) // required
               System.out.println("error reading: " + ex.getMessage()); // for debugging
          catch(ClassNotFoundException ex) // required
               System.out.println("error reading: " + ex.getMessage()); // for debugging
          }My first proper attempt at using arrays.
Thanks

Similar Messages

  • DAQ output to "Array to spreadhseet string"

    Please see attached and advice what I am doing wrong.  Cannot connect DAQ output to Array and write a file.  Thanks for any help you can provide.  This is in LabView 8.0.
    Attachments:
    Battery Test 2.vi ‏81 KB

    You guys have been so helpful and I am amazed at your knowledge level.  I have revised my program using your inputs.  I have moved to one while loop and moved the report writing function outside the loop assuming that the report will be written once per Dennis' inputs, reduced the sampling size significantly per Ravens Fan's inputs and RTSLVU's inputs on getting rid of the connection errors. 
    One question I have is shouldn't this not be a 2-D output i.e. Voltage vs. Time?  Please see attached and kindly offer any inputs you may have.  I will appreciate anything you can comment on in programming or dressing up the front panel.  My experience level with this is one month.  Thank you so much.
    Attachments:
    Battery Test 3.vi ‏80 KB

  • How do i output multiple arrays from a case structure to create one larger array

    I currently have a vi that has one hardware input that i needed to take a measurement then be moved and take a similar measurement at a different point.  To accomplish this i used a while loop inside a case structure.  The while loop takes the measurement  and finds the numbers i need while the case structure is changed per the new measurement location.  I want to take the data points i have created in each case and output them into a single table.  I assumed to do this the best way would be to get the data from each case into its own built array and build a larger array but I cant get the information out of the case structure so that it all inputs at different places.
    thanks for your help
    Attachments:
    Array.vi ‏30 KB

    Hi Ross,
    attached you will find a solution for your table building problem.
    I would suggest thinking about program design - having the same case content in several cases doesn't make sense. I also would not want my user to press several stop buttons depending on choosen measurement...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    Array.vi ‏45 KB

  • Getting "null" in output with array

    Could someone please help me in knowing why my output is off? I know where the error is occuring, but I cant figure out what is going on. Any help is appreciated and I thank you beforehand. Sorry it is so long, but I wanted to provide enough information.
    The output for the given input test data is shown below:
    Records in original order...
    2847 3.89 Arthur C. Clarke
    7395 4.00 Rosalind Franklin
    4916 3.25 Ryazzudin
    9472 2.38 Joe College
    4583 0.36 Joe Camel
    8365 2.84 Typical J. Student
    6395 3.27 Tammy Abel
    4962 3.67 R. E. A. C. Paley
    Records sorted by ID number...
    2847 3.89 Arthur C. Clarke
    4583 0.36 Joe Camel
    4916 3.25 Ryazzudin
    4962 3.67 R. E. A. C. Paley
    6395 3.27 Tammy Abel
    7395 4.00 Rosalind Franklin
    8365 2.84 Typical J. Student
    9472 2.38 Joe College
    Records sorted by GPA...
    7395 4.00 Rosalind Franklin
    2847 3.89 Arthur C. Clarke
    4962 3.67 R. E. A. C. Paley
    6395 3.27 Tammy Abel
    4916 3.25 Ryazzudin
    8365 2.84 Typical J. Student
    9472 2.38 Joe College
    4583 0.36 Joe Camel
    Records sorted by name...
    2847 3.89 Arthur C. Clarke
    4583 0.36 Joe Camel
    9472 2.38 Joe College
    4962 3.67 R. E. A. C. Paley
    7395 4.00 Rosalind Franklin
    4916 3.25 Ryazzudin
    6395 3.27 Tammy Abel
    8365 2.84 Typical J. Student
    This is the output that I am receiving when I run the below code:
    Records in original order...
    null
    Records sorted by ID Number...
    null
    Records sorted by GPA...
    null
    Records sorted by name...
    null
    <CODE>
    import java.io.*;
    import java.text.DecimalFormat;
    import java.util.StringTokenizer;
    public class Pgm06
    public static void main(String[] args) throws IOException
    final int ARRAY_SIZE = 30;
    Student6[] studentArray = new Student6[ARRAY_SIZE];
    Student6 student;
    int identNum, numStudents;
    double gradeAvg;
    String fullName;
    String sIn;
    BufferedReader brIn;
    brIn = new BufferedReader(new InputStreamReader(System.in));
    DecimalFormat decFmt = new DecimalFormat("0.00");
    StringTokenizer tokenizer;
    sIn = brIn.readLine();
    numStudents = 0;
    while(sIn != null)
    numStudents++;
    tokenizer = new StringTokenizer(sIn);
    identNum = Integer.parseInt(tokenizer.nextToken());
    gradeAvg = Double.parseDouble(tokenizer.nextToken());
    fullName = "";
    while(tokenizer.hasMoreTokens())
    fullName += tokenizer.nextToken() + " ";
    student = new Student6(identNum, gradeAvg, fullName);
    studentArray[numStudents - 1] = student;
    sIn = brIn.readLine();
    } // end while loop
    System.out.println("Records in original order...\n" +
    studentArray[numStudents]);
    Pgm06.selectionSort(studentArray, numStudents, 1);
    System.out.println("Records sorted by ID Number...\n" +
    studentArray[numStudents]);
    Pgm06.selectionSort(studentArray, numStudents, 2);
    System.out.println("Records sorted by GPA...\n" +
    studentArray[numStudents]);
    Pgm06.selectionSort(studentArray, numStudents, 3);
    System.out.println("Records sorted by name...\n" +
    studentArray[numStudents]);
    } // end of main method
    public static void selectionSort(Student6[] array, int numStudents,
    int criterion)
    Student6 temp;
    int min;
    for (int index = 0; index < numStudents; index++)
    min = index;
    for (int scan = index + 1; scan < numStudents; scan++)
    if(array[min].belongsAfter(array[scan], criterion))
    temp = array[scan];
    array[scan] = array[min];
    array[min] = temp;
    } // end of method selectionSort
    } // end class Pgm06
    >
    >
    >
    <STUDENT CODE>
    import java.io.*;
    import java.util.StringTokenizer;
    public class Student6
    private String fullName;
    private double gradeAvg;
    private int identNum;
    public Student6(int IDNumber, double GPA, String name)
    identNum = IDNumber;
    gradeAvg = GPA;
    fullName = name;
    } // end constructor Student6
    public boolean belongsAfter(Student6 student, int criterion)
    if(criterion == 1)
    return (identNum > student.identNum);
    else if(criterion == 2)
    return (gradeAvg < student.gradeAvg);
    else if(criterion == 3)
    return (fullName.compareTo(student.fullName) > 0);
    else
    return false;
    } // end method belongsAfter
    public String toString()
    String result;
    result = identNum + "\t" + gradeAvg + "\t" + fullName;
    return result;
    } // end method public String toString
    } // end class Student6
    <INPUTFILE>
    2847 3.89 Arthur C. Clarke
    7395 4.00 Rosalind Franklin
    4916 3.25 Ryazzudin
    9472 2.38 Joe College
    4583 0.36 Joe Camel
    8365 2.84 Typical J. Student
    6395 3.27 Tammy Abel
    4962 3.67 R. E. A. C. Paley

    Obviously homework, so I'll take a Socratic dialog sort of approach:
    What do you think this:
    System.out.println("Records in original order...\n" +
                       studentArray[numStudents]);would do, and why?
    What is studentArray?
    What is numStudents?
    What value does numStudents have?
    What value does studentArray[numStudents] have? (hint: it's in your output)

  • Xcelsius component output problem (array)

    ok so basically i'm developing a non visual component ..... I have written the code and property sheet .... The problem is when i work it in excel , the destination cells don't show ..... However i checked my code with an alert command and i could see my output array that is bound to the destination property ..... i'm not using arraycollection....i could provide the code if necessary ..... also if my source cells are changed dynamically my destination cells don't change .... i tried commitprops .... pls help

    i mean work it in xcelsius*

  • How to print this output. (Array)

    Hi all. I have two String array:
    String[] a = { "a", "b", "c", "d", "e" };
    String[] b = { "b", "d" };
    I want to print this two array into this output:
    Output:
    a
    bb
    c
    dd
    e
    Anybody can help me how to get this output. I have try with a for loop, but it's not working.

    try this,
    boolean found=false;
    for(int i=0; i<a.length;i++)
             found=false;
             for(int j=0;j<b.length;j++)
                     if(a.equals(b[j])
    found=true;
    if(found==true)
    System.out.println(a[i]+a[i]);
    else
    System.out.println(a[i]);

  • How to store select query output in arrays.

    i created a varray type variables and now want to assign some data though select query output in pl/sql code as well as in reports 6i.

    You're in the wrong forum (this one is for issues with the SQL Developer tool). You were in the right one where you posted first, but don't reuse unrelated threads as you did.
    Regards,
    K.

  • Output labview array to LED grid using DI/O on Elvis II??

    I have been working on a project. I am attempting to use the DI/O on the ELvis II board to power an 10x6 LED grid similar 
    to the common-row cathode design here
    http://www.appelsiini.net/2011/how-does-led-matrix-work
    I have been attempting to generate block patterns using an array in labview, then somehow convert this array to show the block pattern on the grid. I was planning on using DI/O 0-5 to power the columns and DI/O 6-15 to power the rows. Is such a thing even possible? So far I have created a simple DAQ assistant to control the DI/O on the board and can control values that way. i was just interested in knowing if they can be controlled using a labview program.

    Generate digital pulse from your D I/O to control the relay. With Digital High State, the mechanical arrangement will connect the COMM to "NO" .... and you will get your programmable Ground. (in your case NC is not necessary I hope) 
    The device is not so costly. you can purchase 4-5 number with your pocket money only. And It must be available to your nearby Electronics Shop. Use 1 for each line.
    Attachments:
    Relay.PNG ‏8 KB

  • Output 2 array elements onto excel spreadsheet

    Hello all, I am fairly new to LabVIEW and need some help.
    I'm trying to measure the output of a multimeter and send it on the the excel filesheet.
    The scenario is like this:
    I'm using 4 sequences
    The mutlimeter and power supply stated below are physical power supplies using VISA session
    1st Sequence
    Controls the power supply and adjust the voltage to 5 volts
    Obtain measurements from multimeter
    2nd Sequence
    Timer wait 500ms
    3rd Sequence
    Controls the power supply and adjust the voltage to 0 volts
    Obtain measurements from multimeter
    4th Sequence
    Timer wait 500ms
    All these sequence are wrapped around by a infinite while loop. And will stop looping once the stop button is pressed.
    What I want to achieve is to store the measurements of the multimeter when 5 volts and 0 volts is supplied and store it into a spreadsheet(the same spreadsheet with both measurements). These measurement will be stored continuously untill the stop button is pressed. So I can see a list of measurements.
    The problem I'm having now is that it only stores the last measurement and overwrites the old ones.
    Below is a copy of my VI. Please help me out here. Thank you
    Attachments:
    Working_Power_Supply.vi ‏44 KB

    Not having the subvi's on hand, i'm just guessing here.
    There's a coupla ways to accomplish this - here's an example using a shift register and a sequence local.
    2006 Ultimate LabVIEW G-eek.
    Attachments:
    Working_Power_Supply_2.vi ‏37 KB

  • Array output question

    Hello,
    I'm trying to get this foreach to output to HTML.
    What I need help with is how to make this report output the array data.
    $MyCollection = @()
    $arrViewPropertiesToGet = "Name","Summary.Runtime.PowerState","Config.GuestFullName","Summary.Config.Annotation","CustomValue","AvailableField"
    foreach ($cluster in Get-Cluster) {
        Get-View -ViewType VirtualMachine -Property $arrViewPropertiesToGet -SearchRoot $cluster.id | Select `
      @{n="VM name"; e={$_.Name}},
            @{n="Cluster"; e={$cluster.name}},
      #@{n="PowerState"; e={$_.Summary.Runtime.PowerState}},
            @{n="Guest OS"; e={$_.Config.GuestFullName}},
            @{n="Notes"; e={$_.Summary.Config.Annotation}},
            ## just using the data already retrieved; far faster
            @{n="Tier"; e={$viewThisVM = $_; ($viewThisVM.CustomValue | ?{$_.Key -eq ($viewThisVM.AvailableField | ?{$_.Name -eq "Tier"}).Key}).Value}}
      $MyCollection += $viewThisVM
    } ## end foreach
    $MyCollection | ConvertTo-HTML -Fragment | Set-Content c:\temp\test.htm
    Invoke-Expression C:\temp\test.htm
    Here is what I know how to do, but need help with the array part, everything else is working great.
    #Sample Code
    Get-Service | Select-Object Status, Name, DisplayName | ConvertTo-HTML | Out-File C:\Scripts\Test.htm
    Invoke-Expression C:\Scripts\Test.htm
    Thanks,
    -Mike

    Hi sneddo,
    That is the complete script.
    $MyCollection = @()
    $arrViewPropertiesToGet = "Name","Summary.Runtime.PowerState","Config.GuestFullName","Summary.Config.Annotation","CustomValue","AvailableField"
    foreach ($cluster in Get-Cluster) {
        Get-View -ViewType VirtualMachine -Property $arrViewPropertiesToGet -SearchRoot $cluster.id | Select `
      @{n="VM name"; e={$_.Name}},
            @{n="Cluster"; e={$cluster.name}},
      #@{n="PowerState"; e={$_.Summary.Runtime.PowerState}},
            @{n="Guest OS"; e={$_.Config.GuestFullName}},
            @{n="Notes"; e={$_.Summary.Config.Annotation}},
            ## just using the data already retrieved; far faster
            @{n="Tier"; e={$viewThisVM = $_; ($viewThisVM.CustomValue | ?{$_.Key -eq ($viewThisVM.AvailableField | ?{$_.Name -eq "Tier"}).Key}).Value}}
      $MyCollection += $viewThisVM # we can delete this line, I was testing here.
    } ## end foreach
    $MyCollection | ConvertTo-HTML -Fragment | Set-Content c:\temp\test.htm
    If you test this part in your lab it works great.
    $arrViewPropertiesToGet = "Name","Summary.Runtime.PowerState","Config.GuestFullName","Summary.Config.Annotation","CustomValue","AvailableField"
    foreach ($cluster in Get-Cluster) {
        Get-View -ViewType VirtualMachine -Property $arrViewPropertiesToGet -SearchRoot $cluster.id | Select `
      @{n="VM name"; e={$_.Name}},
            @{n="Cluster"; e={$cluster.name}},
      #@{n="PowerState"; e={$_.Summary.Runtime.PowerState}},
            @{n="Guest OS"; e={$_.Config.GuestFullName}},
            @{n="Notes"; e={$_.Summary.Config.Annotation}},
            ## just using the data already retrieved; far faster
            @{n="Tier"; e={$viewThisVM = $_; ($viewThisVM.CustomValue | ?{$_.Key -eq ($viewThisVM.AvailableField | ?{$_.Name -eq "Tier"}).Key}).Value}}
    } ## end foreach
    I just need this part to export to a HTML Web Page.
    Thanks,

  • Array output of a Labview dll

    Hi all,
    I haven´t found the solution in the posts of this forum, if somebody has, please inform me.
    I want to output an array from a dll compiled in LV7.1. It doesn´t work. I have tried all the combinations of Array Data Pointer & Array Handle Pointer, and the two calling conventions, and it doesn´t work. My output array (Y) is always the unchanged input array. Any idea?

    Whithout having your DLL it's difficult to say why your code is not working. There are different ways to pass array data, please also have a look at the examples that are contained in LabVIEW.
    You can also find a pretty good tutorial here 

  • Building DLLs from VIs with array as output

    Is there any special way to build DLLs from VIs having arrays as outputs. Suppose I have a VI "Random" with input "nrand" and output an array "the_random2". When I build DLL from the VI, I have something like this in my header file
    void __stdcall Random(long nrand, double the_random2[]);
    Now it returns void. So I have to pass the array as pointer and retrieve it. If I use Mathscript to load the DLL and call this function, how do I pass the pointer to the array "the_random2"? Simply speaking, any useful method to build DLLs with array outputs and the right way to call them from Mathscript would be appreciated.
    Regards
    NRK

    Hi,
    Building DLLs in LabVIEW is described in this tutorial.  
    Mathscript can call shared libraries such as DLLs, however make sure
    that they are compliant with the supported data types as stated here in
    this help page.  All supported functions for calling/loading shared libraries is described here. 
    Note that these functions are not supported with the base package.  The
    details of the sytax of each function is described in their specific
    help page.
    Hope this helps!
    Regards,
    Nadim
    Applications Engineering
    National Instruments

  • How come the output of the Array Subset VI is 2-D when I specify a 1-D subset?

    1. I'm trying to strip off a row from a 2-D array so I can search for a match within that row. When I use Array Subset and specify one row as the subset (for example, Row Index=0, Row Length=1, Column Index=0, Column Length=(a variable, typically 255), the output is a 2-D array.
    2. Do I have to use Reshape Array on the output of Array Subset to get the desired 1-D array? The help popup says I have have to add m dimension sizes to have the output be an m-dimensional array. If I add a dimension size, I get a 2-D output. If I fall back to one dimension size and hardwire it to '1', I get a 1-D array wire type but apparently the array doesn't contain all the data in the row from the original 2-D array.
    I'm using LV 5.1. What is the easiest way to strip off a row from a 2-D array in LV 5.1?
    I appreciate any help you can provide.
    Thanks,
    Jeff Bledsoe
    Jeffrey Bledsoe
    Electrical Engineer

    JeffreyP wrote:
    What is the easiest way to strip off a row from a 2-D array in LV 5.1?
    The easiest way to has always been just to use the "Index Array" function, choosing the indice of the row you wanted and with nothing wired to the column terminal (the lower one).
    Edit: I'm assuming that by "strip off" you mean "access", not "strip out"/"remove".Message Edited by Donald on 05-13-2005 02:03 PM
    =====================================================
    Fading out. " ... J. Arthur Rank on gong."
    Attachments:
    Index Out Row.jpg ‏6 KB

  • Newbie Seeking Help With Array Output!

    Hey all, I'm new here, so here goes nothing! :) I'm in my first programming class at college, and we need to output multiple arrays. We're using JTextAreas and I'm not sure how I should go about this, but this is what I have so far:
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Application1
    public Application1()
    String name[]={"Mary","John","William","Debbie","Ralph"};
    int temp[]={34,24,78,65,45,100,90,97,56,89,78,98,74,90,98,24,45,76,89,54,12,20,22,55,6};
    int [][]scores=new int[8][8];
    float []avg=new float[5];
    char []lettergrade={'F','F','F','F','F'}; //Initialized at "F" and replaced by their actual grade
    String out="";
    move_score(temp,scores);
    tot_hi_low(scores);
    average(scores,avg,lettergrade); //Calculates Average and Letter Grade
    graph(scores,avg);
    JTextArea outarea=new JTextArea(8,8); //Output
    out+="Name\t"+"Test1\t"+"Test2\t"+"Test3\t"+"Test4\t"+"Final\t"+"Total\t"+"High\t"+"Low\t"+scores;
    outarea.setText(out);
    JOptionPane.showMessageDialog(null,outarea);
    public void move_score(int temporary[],int sc[][])
    int c=0;
    for(int a=0;a<=4;a++) //Moves values of "temp" into 2D array "scores"
    for(int b=0;b<=4;b++)
    sc[a]=temporary[c];
    c++;
    public void tot_hi_low(int [][]score)
    int d=100; //Low Variable
    int e=-1; //High Variable
    for(int r=0;r<=4;r++)
    for(int c=0;c<=4;c++)
    score[r][5]+=score[r][c]; //Total for Columns
    score[5][r]+=score[c][r]; //Total for Rows
    if(score[r][c]>e) //High for Columns
    e=score[r][c];
    score[r][6]=e;
    if(score[c][r]>e) //High for Rows
    e=score[c][r];
    score[6][r]=e;
    if(score[r][c]<d) //Low for Columns
    d=score[r][c];
    score[r][7]=d;
    if(score[c][r]<d) //Low for Rows
    d=score[c][r];
    score[7][r]=d;
    public void average(int [][]score,float []avg,char []grade){
    int l=800;
    for(int a=0;a<=4;a++)
    for(int b=0;b<=3;b++)
    if(score[a][b]<l)
    l=score[a][b];
    avg[a]=(score[a][5]-l+score[a][4])/5.0f;
    if(avg[a]>=60) //Assigns Letter Grades
    grade[a]='D';
    if(avg[a]>=70)
    grade[a]='C';
    if(avg[a]>=80)
    grade[a]='B';
    if(avg[a]>=90)
    grade[a]='A';
    public void graph(int [][]score,float []average){
    //DECLARE EVERYTHING HERE
    //DECLARE ARRAYS
    public static void main(String args[]){
    Application1 app=new Application1();
    System.exit(0);

    Ah sorry about that; like I said I'm fresh off the 'coding' boat. What I meant to ask in my original post is: "Could someone show me an example of how I could get arrays into output?" I am definately not looking for someone to do my work for me, but I am at a dead end, and would appreciate any examples or even tips! Here is what I have:
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Application1
    public Application1()
    String name[]={"Mary","John","William","Debbie","Ralph"};
    int temp[]={34,24,78,65,45,100,90,97,56,89,78,98,74,90,98,24,45,76,89,54,12,20,22,55,6};
    int [][]scores=new int[8][8];
    float []avg=new float[5];
    char []lettergrade={'F','F','F','F','F'}; //Initialized at "F" and replaced by their actual grade
    String out="";
    move_score(temp,scores);
    tot_hi_low(scores);
    average(scores,avg,lettergrade); //Calculates Average and Letter Grade
    graph(scores,avg);
    JTextArea outarea=new JTextArea(8,8); //Output
    out+="Name\t"+"Test1\t"+"Test2\t"+"Test3\t"+"Test4\t"+"Final\t"+"Total\t"+"High\t"+"Low\n"+scores;
    outarea.setText(out);
    JOptionPane.showMessageDialog(null,outarea);
    public void move_score(int temporary[],int sc[][])
    int c=0;
    for(int a=0;a<=4;a++) //Moves values of "temp" into 2D array "scores"
    for(int b=0;b<=4;b++)
    sc[a]=temporary[c];
    c++;
    public void tot_hi_low(int [][]score)
    int d=100; //Low Variable
    int e=-1; //High Variable
    for(int r=0;r<=4;r++)
    for(int c=0;c<=4;c++)
    score[r][5]+=score[r][c]; //Total for Columns
    score[5][r]+=score[c][r]; //Total for Rows
    if(score[r][c]>e) //High for Columns
    e=score[r][c];
    score[r][6]=e;
    if(score[c][r]>e) //High for Rows
    e=score[c][r];
    score[6][r]=e;
    if(score[r][c]<d) //Low for Columns
    d=score[r][c];
    score[r][7]=d;
    if(score[c][r]><d) //Low for Rows
    d=score[c][r];
    score[7][r]=d;
    public void average(int [][]score,float []avg,char []grade){
    int l=800;
    for(int a=0;a<=4;a++)
    for(int b=0;b<=3;b++)
    if(score[a]><l)
    l=score[a];
    avg[a]=(score[a][5]-l+score[a][4])/5.0f;
    if(avg[a]>=60) //Assigns Letter Grades
    grade[a]='D';
    if(avg[a]>=70)
    grade[a]='C';
    if(avg[a]>=80)
    grade[a]='B';
    if(avg[a]>=90)
    grade[a]='A';
    public void graph(int [][]score,float []average){
    public static void main(String args[]){
    Application1 app=new Application1();
    System.exit(0);
    }I want to get my scores array into my JTextArea, but the array isn't displaying as I intended it to. Any help would be incredibly useful!

  • Doubt in working of Arrays.sort method. help needed !!!!

    Hello Friends,
    I am not able to understand output of Arrays.sort method. Here is the detail of problem
    I wrote one program :
    public static void main(String[] args) throws ClassNotFoundException
         Object[] a = new Object[10];
         a[0] = new String("1");
         a[1] = new String("2");
         a[2] = new String("4");
         a[3] = new String("3");
         a[4] = new String("5");
         a[5] = new String("20");
         a[6] = new String("6");
         a[7] = new String("9");
         a[8] = new String("7");
         a[9] = new String("8");
    /* Sort entire array.*/
         Arrays.sort(a);
         for (int i = 0; i < a.length; i++)
         System.out.println(a);
    and output is :
    1
    2
    20
    3
    4
    5
    6
    7
    8
    9
    Question : Does this output is correct? If yes then on which basis api sort an array? I assume output should be 1 2 3 4 5 6 7 8 9 20.
    Can here any one please explain this?
    Thanks in advance.
    Regards,
    Rajesh Rathod

    jverd wrote:
    "20" and "3" are not numbers. They are strings, and "20" < "3" is exactly the same as "BA" < "C"The above is
    ... quote 20 quote less than quote 3 quote...
    but shows up as
    ... quote 20 quote less than quote...
    Weird.

Maybe you are looking for