Matrix in  java using  two dimension array

hi!
Everybody here's a problem I have cpould any body out there give nice piece of sourcr code for "matrix in java using two dimension array"I have to give a presentation how it works.Yes I'd appreciate as many example as possible
If anybody can??
Please help
regards
ardent

nice piece of sourcr
code for "matrix in java using two dimension
n arraySure,
int[][] matrix = new int[5][5];
That declares a two-dimensional 5 by 5 array with integer elements. All elements are initially 0.
For further information check you favourite Java textbook.

Similar Messages

  • Selecting one dimension of a two dimension array?

    hi, i want to select only one dimension of an array and put it into an arraylist (or casting the array verbatim into the arraylist)
    for example, here is an two dimension array:
    Object[][] data =
         {  { new Date(), "A", new Integer(1), Boolean.TRUE },
         { new Date(), "B", new Integer(2), Boolean.FALSE },
         { new Date(), "C", new Integer(9), Boolean.TRUE },
         { new Date(), "D", new Integer(4), Boolean.FALSE}
         };and i want to cast it into an arraylist, what i have in mind (a bit troublesome is the following:)
    ArrayList dataArray = new ArrayList();
    dataArray.add(data[0]);
    dataArray.add(data[1]);
    dataArray.add(data[2]);
    dataArray.add(data[3]);
    System.out.println(dataArray);when come upon the last System.out.println, i got some seemly useless addresses:
    [[Ljava.lang.Object;@f73c1, [Ljava.lang.Object;@789144, [Ljava.lang.Object;@1893efe, [Ljava.lang.Object;@186c6b2]
    how do you accomplish casting a two dimension array into an arraylist, but the second dimension of the arraylist is kept as Array of Objects? thanks alot!

    First, the strings that are printed out are the value of the hashcode for the specific object. That is the default value that is printed out for any object reference in a class that inherits the toString() method from the Object class. This is true for arrays. Your ArrayList contains array references in it..
    So, you are printing the object hashcodes for the arrays in your ArrayList, instead of the contents of those arrays. It would be better if you created ArrayLists, or even designed an object that stores your data, and stored those inside your ArrayList. ArrayList has an overwritten toString() method that will print the contents instead of the object hashcode, so an ArrayList containing ArrayLists would print your data the way you want. If you define your own class, you will need to provide a toString() method that prints the contents the way you want.
    PS, look at http://java.sun.com/j2se/1.5.0/docs/api/java/util/AbstractCollection.html#toString() for more information on the toString() method used by ArrayList.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Two dimension array?

    Show me the code for two dimension array in JSP!
    Thanks in advance!

    Hi,
    I am new in Java but maybe I can help you:
    Two-dimnsional arrays you can declare in following way:
    String[][] someArray;
    When you want to allocate space for new array you can do something like this:
    someArray = new String[5][5];
    All Arrays have a data variable called length, which you can inspect to find out how many elements there are in the array.
    For multi-dimensional arrays, each dimension has a length property.
    int[] [] a1 = {{ 0, 1, 2 },{ 3, 4, 5 }};
    for (int i=0; i < a1.length; i++) {
    for (int j=0; j < a1.length; j++) {
    prt(i + "," + j + "=" + a1[i][j]);
    Hope this is of help to you.
    Mirkos

  • How to use two dimensional array in custom.pll

    HI
    How to use two dimensional arrays in custom.pll
    I tried by the following way .
    type ship_array is table of number index by binary_integer;
    type vc_array is table of ship_array index by binary_integer;
    But I am getting the error as that
    A plsql table may not contain a table or a record with composite fields.
    Please tell me the way how to use them

    which forms version are you using? two dimensional arrays are available in >= 9i if memory serves.
    regards

  • How can I use two dimensional array ?

    Could some one show me how to use two dimentional array ?
    I am know how to right a single ...but not two dimentional....please help,
    Thanks,
    Flower
    public class Exam5
    public static void main(String[] args)
    int[][] numbers =
         {     {1,2,3,4,5,6,7,8,9,10},
    {1,2,3,4,5,6,7,8,9,10} };
    for(int i = 1; i < 11; ++i)
    System.out.println(i + "\t" + i * 2 + "\t" + i * 3 + "\t" + i * 4 + "\t" + i * 5 +
    "\t" + i * 6 + "\t" + i * 7 + "\t" + i * 8 + "\t" + i * 9 + "\t" + i * 10);
    Display #
    1     2     3     4     5     6     7     8     9     10
    2     4     6     8     10     12     14     16     18     20
    3     6     9     12     15     18     21     24     27     30
    4     8     12     16     20     24     28     32     36     40
    5     10     15     20     25     30     35     40     45     50
    6     12     18     24     30     36     42     48     54     60
    7     14     21     28     35     42     49     56     63     70
    8     16     24     32     40     48     56     64     72     80
    9     18     27     36     45     54     63     72     81     90
    10     20     30     40     50     60     70     80     90     100

    First, try not to ask someone to do your homework for you and then tell them they are wrong. The code posted may not have been exactly what you were looking for, but it was not wrong because it did exactly what the poster said it would do - print out the multiplication table.
    Second, in the future if you ask specific questions rather than posting code and hoping someone will fix it for you, you may one day be able to complete the assignments on your own.
    Here is code that prints what you want and uses a two dimensional array. Please ask questions if you do not understand the code. You will never learn if you just use someone else's code without taking the time to examine or understand it.
    public class MultiTable{  
        public static void main(String[] args)   { 
            int rows = 10;
            int columns = 10;
            int [][] numbers = new int [rows] [columns];
            for(int j = 0; j < rows; j++)   // for each of 10 rows
                for(int k = 0; k < columns; k++)    // for each of 10 columns
                    numbers[j][k] = (j+1) * (k+1);  // calculate row+1 * col+1
            for (int j = 0; j < rows; j++)  // for each of 10 rows
                for (int k = 0; k < columns; k++)   // for each of 10 columns
                    System.out.print(numbers[j][k]+" ");    // print out result
                    if (numbers[j][k] < 10)     // for single digit numbers
                        System.out.print(" ");  // print extra space for better formatting
                System.out.println();       // skip to next line
    }

  • How to clear two dimension array and content in JTextArea

    hi all....
    i have a problem to clear the counter in JTextArea..currently i design a program to store all the student details in two dimensian array...when i click "RESET"button..it will only reset the textarea..but can not clear the actual content inside the array..and when i click "Print Button" again..it's supposed nothing to display..but it displayed the thing which i previously entered......
    so i think i need to clear the array...i use append to insert the text...,for this i also can not reset...
    which the code is shown below :
    txtArea.append(msg1);
    the coding for reset area as below :
    txtArea.setText("")
    Anyone can help me?????
    thks...

    How are you trying to reset the array?, you can just creat a new array.
    Noah

  • Two dimensional array in JSP with struts

    Is it possible to use two dimensional array in an web application
    based on struts. I am using JSP and to get data from two dimensional
    array im using
    property = "array[0][0]";I read on the internet that bean utils does not support two dimensional array?
    I have a table like spreadsheet with 30 rows and 20 columns and i was
    planning to use two dimensional array? is there any other way to get
    this stuff done easily?
    any ideas welcome.

    HI ,
    i have the same problem you had
    did you get any solution for this?
    if so you can help me out

  • Binary search tree in java using a 2-d array

    Good day, i have been wrestling with this here question.
    i think it does not get any harder than this. What i have done so far is shown at the bottom.
    We want to use both Binary Search Tree and Single Linked lists data structures to store a text. Chaining
    techniques are used to store the lines of the text in which a word appears. Each node of the binary search
    tree contains four fields :
    (i) Word
    (ii) A pointer pointing to all the lines word appears in
    (iii) A pointer pointing to the subtree(left) containing all the words that appears in the text and are
    predecessors of word in lexicographic order.
    (iv) A pointer pointing to the subtree(right) containing all the words that appears in the text and are
    successors of word in lexicographic order.
    Given the following incomplete Java classes BinSrchTreeWordNode, TreeText, you are asked to complete
    three methods, InsertionBinSrchTree, CreateBinSrchTree and LinesWordInBinSrchTree. For
    simplicity we assume that the text is stored in a 2D array, a row of the array represents a line of the text.
    Each element in the single linked list is represented by a LineNode that contains a field Line which represents a line in which the word appears, a field next which contains the address of a LineNode representing the next line in which the word appears.
    public class TreeText{
    BinSrchTreeWordNode RootText = null;// pointer to the root of the tree
    String TextID; // Text Identification
    TreeText(String tID){TextID = tID;}
    void CreateBinSrchTree (TEXT text){...}
    void LinesWordInBinSrchTree(BinSrchTreeWordNode Node){...}
    public static void main(String[] args)
    TEXT univ = new TEXT(6,4);
    univ.textcont[0][0] = "Ukzn"; univ.textcont[0][1] ="Uct";
    univ.textcont[0][2] ="Wits";univ.textcont[0][3] ="Rhodes";
    univ.textcont[1][0] = "stellenbosch";
    univ.textcont[1][1] ="FreeState";
    univ.textcont[1][2] ="Johannesburg";
    univ.textcont[1][3] = "Pretoria" ;
    univ.textcont[2][0] ="Zululand";univ.textcont[2][1] ="NorthWest";
    univ.textcont[2][2] ="Limpopo";univ.textcont[2][3] ="Wsu";
    univ.textcont[3][0] ="NorthWest";univ.textcont[3][1] ="Limpopo";
    univ.textcont[3][2] ="Uct";univ.textcont[3][3] ="Ukzn";
    univ.textcont[4][0] ="Mit";univ.textcont[4][1] ="Havard";
    univ.textcont[4][2] ="Michigan";univ.textcont[4][3] ="Juissieu";
    univ.textcont[5][0] ="Cut";univ.textcont[5][1] ="Nmmu";
    univ.textcont[5][2] ="ManTech";univ.textcont[5][3] ="Oxford";
    // create a binary search tree (universities)
    // and insert words of text univ in it
    TreeText universities = new TreeText("Universities");
    universities.CreateBinSrchTree(univ);
    // List words Universities trees with their lines of appearance
    System.out.println();
    System.out.println(universities.TextID);
    System.out.println();
    universities.LinesWordInBinSrchTree(universities.RootText);
    public class BinSrchTreeWordNode {
    BinSrchTreeWordNode LeftTree = null; // precedent words
    String word;
    LineNode NextLineNode = null; // next line in
    // which word appears
    BinSrchTreeWordNode RightTree = null; // following words
    BinSrchTreeWordNode(String WordValue)
    {word = WordValue;} // creates a new node
    BinSrchTreeWordNode InsertionBinSrchTree
    (String w, int line, BinSrchTreeWordNode bst)
    public class LineNode{
    int Line; // line in which the word appears
    LineNode next = null;
    public class TEXT{
    int NBRLINES ; // number of lines
    int NBRCOLS; // number of columns
    String [][] textcont; // text content
    TEXT(int nl, int nc){textcont = new String[nl][nc];}
    The method InsertionBinSrchTree inserts a word (w) in the Binary search tree. The method Create-
    BinSrchTree creates a binary search tree by repeated calls to InsertionBinSrchTree to insert elements
    of text. The method LinesWordInBinSrchTree traverses the Binary search tree inorder and displays the
    words with the lines in which each appears.
    >>>>>>>>>>>>>>>>>>>>>>
    //InsertionBinTree is of type BinSearchTreeWordNode
    BinSrchTreeWordNode InsertionBinSrchTree(String w, int line,                                             BinSrchTreeWordNode bst)
    //First a check must be made to make sure that we are not trying to //insert a word into an empty tree. If tree is empty we just create a //new node.
         If (bst == NULL)
                   System.out.println(“Tree was empty”)
         For (int rows =0; rows <= 6; rows++)
                   For (int cols = 0; cols <= 4; cols++)
                        Textcont[i][j] = w

    What is the purpose of this thread? You are yet to ask a question... Such a waste of time...
    For future reference use CODE TAGS when posting code in a thread.
    But again have a think about how to convey a question to others instead of blabbering on about nothing.
    i think it does not get any harder than this.What is so difficult to understand. Google an implementation of a binary tree using a single array. Then you can integrate this into the required 2-dimension array for your linked list implemented as an array in your 2-d array.
    Mel

  • Using two facts of two different star schemas and conformed dimensions

    Hi,
    I've been working as developer and database designer for years and I'm new to Business Objects. Some people says you can not use two facts of two different star schemas in the same query because of conformed dimensions and loop problems in BO.
    For example I have a CUSTOMER_SALE_fACT table containing customer_id and date_id as FK, and some other business metrics about sales. And there is another fact table CUSTOMER_CAMPAIGN_FACT which also contains customer_id and date_id as FK, and some  other business metrics about customer campaigns. SO I have two stars like below:
    DIM_TIME -- SALE_FACT -- DIM_CUSTOMER
    DIM_TIME -- CAMPAIGN_FACT -- DIM_CUSTOMER
    Business metrics are loaded into fact tables and facts can be used together along conformed dimensions . This is one of the fundamentals of the dimensional modeling. Is it really impossible to use SALE_FACT and CAMPAIGN_FACT together? If the answer is No, what is the solution?
    Saying "you cannot do that because of loops" is very interesting.
    Thank you..

    When you join two facts together with a common dimension you have created what is called a "chasm trap" which leads to invalid results because of the way SQL is processed. The query rows are first retrieved and then aggregated. Since sales fact and campaign fact have no direct relationship, the rows coming from either side can end up as a product join.
    Suppose a customer has 3 sales fact rows and 2 campaign fact rows. The result set will have six rows before any aggregation is performed. That would mean that sales measures are doubled and campaign measures are tripled.
    You can report on them together, using multiple SQL passes, but you can't query them together. Does that distinction make sense?

  • How can I use two single-dimensional arrays-one for the titles and array

    I want to Use two single-dimensional arrays-one for the titles and one for the ID
    Could everyone help me how can i write the code for it?
    Flower
    public class Video
    public static void main(String[] args) throws Exception
    int[][] ID =
    { {145,147,148},
    {146,149, 150} };
    String[][] Titles=
    { {"Barney","True Grit","The night before Christmas"},
    {"Lalla", "Jacke Chan", "Metal"} };
    int x, y;
    int r, c;
    System.out.println("List before Sort");
    for(c =0; c< 3; ++c)
    for(r=0; r< 3; ++ r)
    System.out.println("ID:" + ID[c][r]+ "\tTitle: " + Titles[c][r]);
    System.out.println("\nAfter Sort:");
    for(c =0; c< 3; ++c)
    for(r=0; r< 3; ++ r)
    System.out.println("ID:" + ID[c][r]+ "\tTitle: " + Titles[c][r]);

    This is one of the most bizarre questions I have seen here:
    public class Video
    public static void main(String[] args) throws Exception
    int[] ID = {145,147,148, 146,149, 150};
    String[] Titles= {"Barney","True Grit","The night before Christmas", "Lalla", "Jacke Chan", "Metal"};
    System.out.println("List before Sort");
    for(int i = 0; i < Titles.length; i++)
       System.out.println("ID:" + ID[i]+ "\tTitle: " + Titles);
    System.out.println("\nAfter Sort:");
    for(int i = 0; c < Titles.length; i++)
    System.out.println("ID:" + ID[i]+ "\tTitle: " + Titles[i]);
    Generally you don't use prefix (++c) operators in you for loop. Use postfix (c++).
    Prefix means that it will increment the variable before the loop body is executed. Postfix will cause it to increment after.

  • How to use two members from same dimension in Dimension Layout, for HFR

    I am developing a report using Hyperion Financial Reporting. I have taken two dimensions in rows and remaining dimensions in column. After completing one section, I need to make new section of the report on the same grid and page with just adding one more member of the second row dimension. That is data should be the summation of two members of the dimension, say "ACCOUNT".
    Kindly guide me the steps. Also i would like you to know that i am begineer with Hyperion Financial Reporting.
    Thanks
    Roshan

    Can you give some explanation of your gird layout and what you are trying to achieve?
    Like Account and Scenario in row
    Year, Market in columns
    Product in Page
    Regards
    Celvin
    http://www.orahyplabs.com
    Please mark the responses as helpful/correct if applicable

  • Java.sql.SQLException: Internal Error while using oracle.sql.ARRAY.getArray

    Hello All,
    Here is the issue description. Our application uses Oracle Object Types and LIST. We deployed our application on QA environment which has Oracle 10g. Application runs fine...no issues. Now we moved to UAT. UAT environment is same as QA environment and DBA have created replica of QA database.
    Now WAR file which works fine with QA database , somehow doesnt work with UAT database. Application throws following exception when code tries to call getArray() on java.sql.Array.
    We tried to point UAT weblogic to QA database and it worked fine.....but when we point UAT weblogic to UAT database , we get following exception. So we know that this is a database issue.
    DBA claims that QA env database and UAT env database are same.
    Can anybody please tell me what wrong here? What setting is not done on UAT database which is done on QA?
    java.sql.SQLException: Internal Error at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227) at oracle.jdbc.oracore.OracleTypeCOLLECTION.initCollElemTypeName(OracleTypeCOLLECTION.java:975) at oracle.jdbc.oracore.OracleTypeCOLLECTION.getAttributeType(OracleTypeCOLLECTION.java:1005) at oracle.jdbc.oracore.OracleNamedType.getFullName(OracleNamedType.java:96) at oracle.jdbc.oracore.OracleTypeADT.createStructDescriptor(OracleTypeADT.java:1958) at oracle.jdbc.oracore.OracleTypeADT.unpickle81(OracleTypeADT.java:1432) at oracle.jdbc.oracore.OracleTypeUPT.unpickle81UPT(OracleTypeUPT.java:426) at oracle.jdbc.oracore.OracleTypeUPT.unpickle81rec(OracleTypeUPT.java:383) at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81_imgBody_elems(OracleTypeCOLLECTION.java:928) at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81_imgBody(OracleTypeCOLLECTION.java:872) at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81(OracleTypeCOLLECTION.java:692) at oracle.jdbc.oracore.OracleTypeCOLLECTION._unlinearize(OracleTypeCOLLECTION.java:217) at oracle.jdbc.oracore.OracleTypeCOLLECTION.unlinearize(OracleTypeCOLLECTION.java:189) at oracle.sql.ArrayDescriptor.toJavaArray(ArrayDescriptor.java:663) at oracle.sql.ARRAY.getArray(ARRAY.java:282) at weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY.getArray(Unknown Source)
    Please help.

    425260 wrote:
    This can happen if you use the oracle.sql.ARRAY class with WebLogic.
    WebLogic wraps oracle.sql.ARRAY with its own class (i.e. weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY). The easiest solution is to replace oracle.sql.ARRAY with the JDBC standard java.sql.Array.
    <PRE class=jive-pre><CODE class="jive-code jive-java">Object[] items = (Object[])array.getArray();
    <FONT color=navy><B>if</B></FONT> (items.length &gt; 0) <FONT color=navy>{</FONT>
    <FONT color=navy><B>for</B></FONT> (<FONT color=navy><B>int</B></FONT> i = 0; i &lt; items.length; i++) <FONT color=navy>{</FONT>
    Object arrayItem = items;
    <FONT color=navy>}</FONT>
    <FONT color=navy>}</FONT>
    </CODE></PRE>
    The <B>array</B> object is a java.sql.Array. Here no unwrapping of the WebLogic wrapper is needed.
    If you absolutely need the oracle.sql.ARRAY class than you must use an <B>unwrap</B> API on the WebLogic wrapper class.
    <PRE class=jive-pre><CODE class="jive-code jive-java"><FONT color=navy><B>if</B></FONT> (object <FONT color=navy><B>instanceof</B></FONT> weblogic.jdbc.wrapper.Array)
    array = (ARRAY) ( ((weblogic.jdbc.wrapper.Array)object).unwrap(Class.forName(<FONT color=red>"oracle.sql.ARRAY"</FONT>)) );
    <FONT color=navy><B>else</B></FONT>
    array = (ARRAY) object;
    </CODE></PRE>
    Here, <B>array</B> is an oracle.sql.ARRAY. Try to see if this <A class=bodylinkwhite href="http://www.software-to-convert.com/3gp-conversion-software/3gp-to-myspace-video-software.html"><FONT face=tahoma,verdana,sans-serif color=#000 size=1>helps</FONT></A>. Good luck.
    Thanks for your explanation! It's very valuable, It is exactly what I need, I understand this part.

  • Two dimension string array in teststand

    Hello,
    I want to pass a two dimension string array from a labWindows dll into Teststand. My labwindows dll:
    #define NR_columns 12
    #define NR_rows  1200
    #define NR_hight   1024
    int__declspec(dllexport) __stdcall  sort( char pspec[NR_columns][NR_rows][NR_hight])
    The call of the dll in teststand looks like the attached picture in the doc file.
    and I got the error message which shows the attached second picture in the doc file
    what is the problem?
    regards
    samuel
    Attachments:
    Error1.doc ‏94 KB

    Hello Samuel,
    I'm not experienced in LabWindows but I think the reason for this Error is the dimension of FileGlobals.loadspec in TestStand. The Error Dialog displays for this String Array [0..11][0..1200]. That's an array of 12 and 1201 elements but function is expecting 12 and 1200 elements.
    I hope this helps.
    Kind regards
    C. Dietz
    Test Engineering
    digades GmbH
    www.digades.com

  • Using two arrays to hold x,y coordinates

    Hi, all
    Does any1 know how to use 2 arrays to hold x,y coordinates of five rectangles all of which are 30 by 40 pixels in size?

    Your homework assignment probably meant to use a 2-dimensional array, not to create two separate arrays.
    Like this:
    int rectangles[][] = new int[100][100];

  • Very Basic..  Array list Concept.. using two arraylist..

    Hello all,
    Please clear my Arraylist concept.. the problem is that I am using two arraylist one.. in Spriteframe, and other in SpriteFramecollection.. and adding objects to them..
    the problem comes when am adding new frame to framecollection.. instead of adding new.. it changes all previous frames too.. I want to reflect change only in latest one..
    Lets explain me in detail..
    I have used like
    class Project..
         ---> Calculate Button
         ---> MultipleMove Button
         ---> Save Button
    In Calculate class..
         Sprite st = new Sprite();
         SpriteFrame sframe = new SpriteFrame();
         ..// I do some calculation
         st.newSprite(croppedimage, file, 0, 0, number, 0, 0);         //here am creating sprite
         sframe.addSprite(st);                            //here am adding sprite to Spriteframe
    In MultipleMove class..
         SpriteFrame sframe = new SpriteFrame();
         // do some adding and deleting of sprites in frame
    In save class..     //Problem comes here.. Am going crazy!!
         SpriteFrameCollection sframecoll = new SpriteFrameCollection();
         SpriteFrame frame = new SpriteFrame();
    --->     sframecoll.addSpriteFrame(frame);     <------- // am just adding frame to framecollection
         }Now when I am printing elements of Sprite.. frame1, and frame2 gets changed simultaneously.. I mean why frame1 also gets changed..
    am just adding new SpriteFrame.. to spriteframecollection..
    please someone tell me what is wrong in my concept of understanding arraylist..
    as making class objects again and again wrong..
    what should I do to add only newly Frame to framecollection??.. why all previous frame gets changed too.. ??
    gervini
    I have class Sprite, SpriteFrame, SpriteFrameCollection as shown below..
    import java.io.*;
    import java.awt.Image;
    public class Sprite               // Each single sprite
         Image img;
         File file;                 // is filepath where this sprite is located
         int xcord,ycord;           // xcoord,ycoord are real position in frame
         int numberinfile;           // this is the position of the sprite in the raw file
         int mirrorh, mirrorv;      // for normal=00,horizontal=10,vertical=01,both=11
         void newSprite(Image img, File file, int xcord, int ycord, int numberinfile, int mirrorh, int mirrorv)
              this.img = img;
              this.file = file;
              this.xcord = xcord;
              this.ycord = ycord;
              this.numberinfile = numberinfile;
              this.mirrorh = mirrorh;
              this.mirrorv = mirrorv;
    import java.io.*;
    import java.util.*;
    public class SpriteFrame                          // Full One Frame consisting of many sprites..
         static ArrayList spritelist = new ArrayList();               // arraylist containing many sprites
         void addSprite(Sprite sprite)
             spritelist.add(sprite);                              
        void removeSprite(Sprite s)
             spritelist.remove(s);
    import java.io.*;
    import java.util.*;
    public class SpriteFrameCollection                    // Consisting of many frames..
         static ArrayList spriteframelist = new ArrayList();          // Arraylist of many frames
         void addSpriteFrame(SpriteFrame spriteframe)
              spriteframelist.add(spriteframe);
        void removeFrame(SpriteFrame sf)
             spriteframelist.remove(sf);
    }

    It is hard to see what it coursing your problems becouse you only posted axtracts from your code. However I think that it is becouse every time you want to access the methods in SpriteFrame you ar creating a new object. Every time you create a new Strite fram a new, empty ArrayList is being created. What you want to do is create this only once, and pass this instance to the parts of your code that need it.
    Let me try to explain this using a matphor. 2 people are trying to make some tea. One person has access to water and another has access to teabags. Both of them know that there is such a thing as a kettle. What you are doing is; person 1 is creating a kettle and filling it with water. Then person 2 is creating a new kettle and trying to pour the water from it. obviously this doesn't work. You want person 1 to creat a kettle, fill it with water and then pass that kettle to person 2. person 2 takes this kettle and then pours the water from it.

Maybe you are looking for

  • Updates Keep Freezing on Configure Installation

    Hi, I am having a problem with my updates on my mac mini. I am running 10.5.2. The problem I seem to be having is that when I try to install my updates, for example the new Safari and security update. It will download and tell me I have to restart my

  • Multiple types created on included elements

    I have successfully registered three schemas: a, b and c, where b and c include an element defined in table a. For the referenced element I defined the defTable property to TABLEX. I was expecting that TABLEX was populated when inserting elements in

  • Deleted windows partition still in MBR

    Hi, I searched google all day long and found out some clues about what could be the problem (even found someone having the same problem as I have) but no solution to repair beside formatting and reinstalling from scratch. What happened is that I had

  • Menu creation failed

    Hi All, I am facing a problem when I am trying run my addon in SAP 8.81 PL05 and Pl 06 but it is running ok upto PL04.It is giving erron menu creation failed randomly.I have searched the forums regarding this problem and in forums it is written that

  • Can you open files on a pc from time machine?

    Can you open files on a pc from time machine?