How come this isn't working

I try to run this but it won't work.
cArray[0].scores[0] = (Double.valueOf(jtfQuiz2.getText())).doubleValue();
I am using 0 for the indexes just to see if I can get something in them. Then I try to see if anything has been put in them by calling :
jtfQuizAvg.setText(String.valueOf(cArray[0].scores[0]));
I declared an array of 50 objects like this.
CIS[] cArray = new CIS[50];
I have a class (CIS) in a package that I have imported. I am trying to get the scores of the individual tests in to the scores[] array found in that class I have imported.
CIS[] cArray = new CIS[50];
Please please help me!

Well, you don't say what your problem actually is, other than "it won't work", but one thing you should be aware of is thatCIS[] cArray = new CIS[50]; doesn't create an array of 50 CIS objects. Rather, it creates an array that can REFERENCE 50 CIS objects. You still have to create each object as you need it. So if you are getting a NullPointerException, that's because you needcArray[0] = new CIS(); before you use cArray[0].
HTH
Robin

Similar Messages

  • How come this doesn't work?

    for (i=0;i!=(row*col);i++){
    total+=parseFloat(eval("value"+(i+1)));
    trace(total);
    trace(parseFloat(eval("value"+(i+1))));
    total is a variable from a dynamic text box and the
    eval("value"+(i+1)) variables are from input text boxes. The
    trace(parseFloat(eval("value"+(i+1)))); displays the values entered
    in the input boxes correctly but the trace(total); displays NULL
    everytime.
    Variables row and col both = 2, and the input text values =
    random integer (entered by user).
    I'm probably missing something really stupid but i can't see
    what is wrong with this.

    Ah forget it, i just had to do total = 0; before hand, even
    though when i did this without using eval() it worked without
    having to be pre defined.

  • How come this does not work?

    String str = null, gene="";
              int count = 0;
              boolean return_proteins=true;
         while (((str = in.readLine()) != null) && return_proteins ){
                             int index = str.indexOf("gi|");
                             if (index>-1)
                                  count++;
                                  gene = str.substring(index+3);
                                  System.out.println(str.substring(index+3));
                                  //System.out.println(str.substring(str.indexOf("VALIGN=\"TOP\">") + 13));
                                  //index = str.indexOf("(nr-Homo-sapiens)");
                                  //if (index>-1)
                                       //String valign = str.substring(index+17,str.indexOf("</TD>"));
                                       //System.out.println(str.indexOf("</TD>"));
                             StringTokenizer token = new
                             StringTokenizer(str,"gi|");
                             While (token.hasMoreTokens())
                             String subStr=token.nextToken();
                                  System.out.printIn(token.nextToken+"");
                                  outfile.write(count+":" + gene +": \n");
                   }

    Each line of the following part contains errors that shall prevent your code from being compiled:While (token.hasMoreTokens())
    String subStr=token.nextToken();
    System.out.printIn(token.nextToken+"");

  • How does this IMPORT statement works

    can any one tell me how does this statement will work..
    I am wokring on Solution manager system , where in there is a function module SSF_FIELD_LIST
    to which system passes form name.
      import fields to fieldlist
             from database stxfcontr(sf) id l_fullname.
    stxfcontr is a table which contains value of in  a diff
    Regards,
    mayank

    It will import data object stored in memory under named fields to your custom data object fieldlist .
    The table which it is stored is name stxfcontr under RELID (memory area) SF .
    Cluster key (key of the entry) in that table is behind var l_fullname
    Anyhow I think [this link|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/frameset.htm] is more that any explanation. Once you study it, you will understand the above.
    Regards
    Marcin

  • HT1535 This isn't working at all... I follow instructions and it doesn't work.. there's no option in !tunes to add to movies... This is a nightmare, I should have stuck with my PC instead...

    This isn't working, all I need is to add a couple of movies to my Iphone 4s but itunes doesn't seem to have any option to add movies, videos etc.... I should've really just stuck with my PC you guys....  Why do they have to make things so difficult in Apple? really? just to add a **** movie to my Iphone 4s I have to ask for help... This is ridiculous..

    Hi,
    Yes, I know this forum has users like me and it's not Apple. I was only venting and, showing my frustration for Apple. You said if I wanted more help I need to give more info...
    What kind of info? like what kind of Apple computers I have? the specs? etc. I know I need Itunes on a PC as well to add movies to my Iphone 4s but, I also have a Samsung Galaxy S4 and, that phone all I do is Plug it in to my PC and from there on it's really easy because it gives me the option to let my PC see it as a external HDD to where I can litteraly drag my movies that I want into it.. And, boom! I'm done. With Apple is like oh my god, you need this you need that you need the other thing.. Blah Blah Blah LOL.... But, I'm a stubborn bull and I want to add movies to my Iphone 4s. So, what I do is the following, I plug in my iphone 4s to my macbook pro and Itunes launches by itself, then I click on the iphone 4s on the upperr right corner, right after a list appears with all my music, then I click on where it says Movies on the upper left, then I try to drag a movie into the list and there's an error message that appears telling me that the movie wasn't copied to my iphone because it can't be played.... at this point I gave up and here I am asking for help.
    I don't what info you want, I have a iphone 4s, a macbook pro wth OSX Mavericks, 2.6 GHz Intel Core !7 8 GB ram... I also have a Imac which I have put away since we just moved in so, I can't remember the specs but it's about 2 - 3 years older than my macbook pro...  Apple seems easy to use when it comes to graphic design, video editing and, working with audio... When it comes to multimedia, it seems not so great. I hope this is enough info... If not just ask me what you guys would need to know.. Thanks for your help... I appreciate it, hopefully I can master the use of Apple just like PC.

  • When viewing the weather default app with multiple cities, how come there isn't a one click shortcut to go back to the first city?

    When viewing the weather default app with multiple cities, how come there isn't a one click shortcut to go back to the first city?

    3.2 you can make multiple clocks, each clock can have a different alarm.

  • How come this program compiles?

    class Base
         Base()
              int i = 100;
              System.out.println(i);
    public class Pri extends Base
         static int i = 200;
         public static void main(String[] args)
              System.out.println(i);
              Pri p = new Pri();
    i get very confused here. in the main, the value of "i" will be printed to the standard output even before the class Pri is instantiated! how come this program can compile?
    your help will be very much appreciated.
    eileen2

    This is because your class Pri extends Base. Because you didn't specify any class Pri constructor, java automatilcally created a no-argument constructor of class Pri with a call to the superclass constructor Base(). You can validate this by adding another Base constructor with arguments and then removing the no-argument Base constructor. Pri() will not compile.

  • How come there isn't a comma between the city and state when I go to make an envelope with an address book contact?

    How come there isn't a comma between the city and state when I go to make an envelope with an address book contact?

    On an envelope, there's not supposed to be. The US Postal Serveice prefers no punctuation, which can interfere with machine sorters. USPS Address Format

  • HT5037 I have downloaded and installed this tool, but it's still telling me I need to update. Any suggestions why this isn't working for me? I have a Macbook Pro.

    I have downloaded and installed the iPhoto tool to update so my pictures transfer over, but it's still telling me I need to update. Any suggestions why this isn't working for me? I have a Macbook Pro.

    You have to download and RUN the iPhoto library upgrade - then launch iPhoto - If you had iPhoto '08 or earlier (version 7.x.x) - the upgrade is installed in the utilities folder of your Applications folder
    LN

  • How come my apps stop working?

    how come my apps, they work but then they stop working and sometimes (actual all the time) i have to re-download them. and even after i do they work for about a day then stop working.

    Try the standard fixes:
    - Reset. Nothing will be lost
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    Restore from abckup
    - Restore to factory defaults/new iPod.

  • How does this SAVE View works in WAD ?

    Experts,  Before putting this question, i did search for this isssue but couldnt find the correct answer.
    when i run the query in portal i get the correct report. but when i right click on any of the charastractis, i could see the drop down list with some options. in this list of options, there is one entry "Save View"
    I tried saving it, with technical name and desc. but i couldnt find it anywhere.
    does anyone has idea ? how this save view works in Portal ?
    thanx

    Hi, plz. find my answers inline.
    My question is how can we make use of this View. So, what is the importance of VIEW ? How users get benefited ?
    >> If you have scenarios wherein users would want to carry out their own analysis & save for future reference/records, then query views prove to be beneficial. Else creating individual queries to suit user preferences is cumbersome & time consuming.
    I was researching on SDN, and found that if i save it As a VIEW. then if we change the query. the saved view remains unchanged. is that right ? But, what if i remove some characteristics from the query ? Does it remove from the VIEW too ?? Or, Its just, if we make some changes to Key figure structure. It wont make any impact on view.
    >>  You execute a query with its initial view, change the initial view by navigating in the data, and save this new navigational state as a query view. If you later change the initial view of the query in the BEx Query Designer, this change has no effect on the query view previously saved. The query view already exists as an independent object.
    Please let me know. if you find some documentation please post a link, i am happy to read that.
    >> http://help.sap.com/saphelp_nw70/helpdata/en/46/0294bc82f37041e10000000a155369/content.htm
    That if you are using WAD and save as view, you can open using BEx analyzer or the other way around ?
    >> You can create and open a query view from BEx Analyzer or Web / WAD, as long as you have the option to.
    --Priya

  • How does this configurator module work?

    Hello,
    I'm a PHP programmer that has some work that I need to do for
    a client.
    He owns an online tshirt store and wants to develop a
    configurator similar to the own seen here:
    http://propercloth.com/custom-mens-shirts.php#
    You can see as you select fabrics & components the image
    of the shirt on the left updates with the texturised version. My
    client already has a database of his materials ready to plug into
    something like this. I'm quite unfamilar with flash as I mainly do
    backend PHP and I was wondering if someone here might know how this
    flash module works or has some experience coding one so I can get
    my head around how this thing works.
    What is required to create or how would I go about creating:
    1. The base model tshirt
    2. Individual components such as pockets that can be
    shown/hidden
    3. The texturisation engine
    4. Populating the base model with a selected material
    (colour)
    Any advice much appreciated!
    Marv.

    There is no flash on that page. All of that animation is done
    using Javascript. It looks like its using elements from the jquery
    library. You can find out more about it at
    http://www.jquery.com. There are
    other libraries with similar functionality. I prefer mootools:
    http://mootools.net/ .

  • How does this Oracle job works

    Hi everyone!
    One of my buddy has created t his job:
    sys.dbms_job.submit(jobno, 'SendEmail();', (sysdate + 2/86400), null);
    Its sending the emails very frequently.
    How should this job work? Please guide me.
    Thanks in advance.
    Nith

    Here's a demo of an application code / user submitting a job frequently. Each time the JOB_ID changes but the job "seems" to be present in USER_JOBS. It is a new job each time ! The DBMS_JOB.SUBMIT call does not specify an INTERVAL, so a submitted job is executed only once and exits from the queue. The next submission seems to be the same job, but is actually a new one --- which you can identify because JOB_ID changes.
    10:09:21 SQL> create or replace procedure send_email
    10:09:21   2  as
    10:09:21   3  begin
    10:09:21   4   -- do some processing, send an email
    10:09:21   5   null;
    10:09:21   6  end;
    10:09:21   7  /
    Procedure created.
    10:09:21 SQL>
    10:09:21 SQL> variable jno number;
    10:09:21 SQL>
    10:09:21 SQL> exec dbms_job.submit(:jno,'send_email();',(sysdate+5/86400));
    PL/SQL procedure successfully completed.
    10:09:21 SQL> commit;
    Commit complete.
    10:09:21 SQL>
    10:09:21 SQL> select job, what, next_date, next_sec from user_jobs;
           JOB WHAT                                          NEXT_DATE NEXT_SEC
           146 send_email();                                 25-MAY-11 10:09:26
    10:09:21 SQL>
    10:09:21 SQL> exec dbms_lock.sleep(10);
    PL/SQL procedure successfully completed.
    10:09:31 SQL>
    10:09:31 SQL> exec dbms_job.submit(:jno,'send_email();',(sysdate+5/86400));
    PL/SQL procedure successfully completed.
    10:09:31 SQL> commit;
    Commit complete.
    10:09:31 SQL>
    10:09:31 SQL> select job, what, next_date, next_sec from user_jobs;
           JOB WHAT                                          NEXT_DATE NEXT_SEC
           147 send_email();                                 25-MAY-11 10:09:36
    10:09:31 SQL>
    10:09:31 SQL> exec dbms_lock.sleep(10);
    PL/SQL procedure successfully completed.
    10:09:41 SQL>
    10:09:41 SQL> exec dbms_job.submit(:jno,'send_email();',(sysdate+5/86400));
    PL/SQL procedure successfully completed.
    10:09:41 SQL> commit;
    Commit complete.
    10:09:41 SQL>
    10:09:41 SQL> select job, what, next_date, next_sec from user_jobs;
           JOB WHAT                                          NEXT_DATE NEXT_SEC
           148 send_email();                                 25-MAY-11 10:09:46
    10:09:41 SQL>
    10:09:41 SQL> exec dbms_lock.sleep(10);
    PL/SQL procedure successfully completed.
    10:09:51 SQL>
    10:09:51 SQL> exec dbms_job.submit(:jno,'send_email();',(sysdate+5/86400));
    PL/SQL procedure successfully completed.
    10:09:51 SQL> commit;
    Commit complete.
    10:09:51 SQL>
    10:09:51 SQL> select job, what, next_date, next_sec from user_jobs;
           JOB WHAT                                          NEXT_DATE NEXT_SEC
           149 send_email();                                 25-MAY-11 10:09:56
    10:09:51 SQL>
    10:09:51 SQL> exec dbms_lock.sleep(10);
    PL/SQL procedure successfully completed.
    10:10:01 SQL>
    10:10:01 SQL> -- Now, since I have not resubmitted the job, it doesn't appear any more !
    10:10:01 SQL> select job, what, next_date, next_sec from user_jobs;
    no rows selected
    10:10:01 SQL>Notice how the job doesn't appear at the last query ? Because the application / user did not resubmit it after the previous submission and query. So it has "disappeared".
    Hemant K Chitale
    Edited by: Hemant K Chitale on May 25, 2011 2:23 PM
    Edited by: Hemant K Chitale on May 25, 2011 2:25 PM

  • How does this Linked List work?

    Hi.
    I wonder how this linked list work
    import java.util.Scanner;
    public class LinkedList {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            Elem front = null;    // First element of list.
            Elem back  = null;    // Last element of list.
            while (in.hasNext()) {
                String word = in.next();
                Elem e = new Elem();     // Create a new list element.
                e.data = word;           // Set the data field.
                if (front == null) {
                    front = e;            // Back element will be set below.
                } else {
                    back.next = e;       // Link last elem to new element.
                back = e;           
            System.out.println("*** Print words in order of entry");
            Elem curr = front;
            while (curr != null) {
                System.out.println(curr.data);
                curr = curr.next;
    class Elem {
        public Elem next;    // Link to next element in the list.
        public String data;  // Reference to the data.
    }Does anyone know how this allocates memory?
    I feel strange because it's just front = e
    and back = e
    but it never says anything like front.next = back or something..
    Can anyone help me on this?

    Does anyone know how this allocates memory?Memory is allocated on this line:            Elem e = new Elem();     // Create a new list element.
    I feel strange because it's just front = e
    and back = e
    but it never says anything like front.next = back or something..Well, it doesn't need to. Setting .next is taken care of after the initial element is added. It never explicitly says front.next = back because front.next is set when the second element is added. It's set implicitly, on this line:                back.next = e;       // Link last elem to new element.It's implicit in that at that point front and back point to the same element.

  • How come this sound only plays once?

    Here is a program that illustrates what I am doing:
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.sound.sampled.*;
    public class soundApp extends JFrame
        JButton button;                
        Clip clip;
        public soundApp()
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setSize(300,300);
            File file = new File("tada.wav"); 
            try
                AudioInputStream audiosource = AudioSystem.getAudioInputStream(file);
                DataLine.Info info =
                    new DataLine.Info(Clip.class, audiosource.getFormat());
                clip = (Clip)AudioSystem.getLine(info);  
                clip.open(audiosource);
            catch(UnsupportedAudioFileException e){}
            catch(LineUnavailableException e){}
            catch(IOException e){}
            button = new JButton("Play sound");
            button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e){
                if(e.getActionCommand().equals("Play sound"))
                    clip.start();   //HERE IS WHERE I START IT....sorry for caps.
            Container contentpane = getContentPane();
            contentpane.add(button);
            setVisible(true);
      public static void main(String[] args)
          soundApp soundapp = new soundApp();
    }How come the clip only plays once?

    well the answer is simple, because once the clip will stop the sound will stop too. you have not used any loop or anything that shows that the clip should go on forever. you can give some condition like play the clip unless some other button is pressed or some othe action is performed or so on. just use while or any or iterative or conditional statement to get your ay out.

Maybe you are looking for