[3804] in java-interest

home help back first fref pref prev next nref lref last post

Re: Structure in Java

daemon@ATHENA.MIT.EDU (Hideo Inoue)
Tue Nov 28 16:08:50 1995

Date: Tue, 28 Nov 1995 09:26:35 -0800
To: java-interest@java.sun.com
From: hideo-i@tech.toppan.com (Hideo Inoue)

At  8:56 AM 95.11.27 +0000, Ki Hong wrote:
>                      Structure in Java                            11/27/95
>
>Hi all!
>
>I need to define an array of two integer elements.
>It is defined in C as follows:
>
>typedef struct temp {
>    int x;
>    int y;
>}tempstruct;
>
>tempstruct xy[100];
>tempstruct X, Y, Z;
>
>Does anyone know how to define the above statements in Java?
>
>The answer would be greatly appreciated!
>

Try following code....

class tempstruct {
        int x;
        int y;
        public tempstruct() {
                this.x = 0;
                this.y = 0;           
        }
}

tempstruct xy[] = new tempstruct[100];
for(int i = 0;i < 100;i++)
        xy[i] = new tempstruct();

tempstruct X = new tempstruct();
tempstruct Y = new tempstruct();
tempstruct Z = new tempstruct();

If you have any problems, please let me know!
--
Hideo Inoue

-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post