Results 1 to 2 of 2

Thread: Can i create a Struct or a type in Java?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Carolina, Puerto Rico, USA
    Posts
    227

    Question

    Can i create a Struct or a type in Java, like in C/C++
    Struct{
    ... ...
    ... ...
    ... ...
    };?
    or in VB

    Type
    ...
    ...
    ...
    End type?

    I need to do that to put it in a random file.
    thanks.
    NievesJ

  2. #2
    Guest
    Objects are an advanced evolution of Struct / Type.

    An object is an instance of a class.

    Classes are types so to speak. Data Types, but much more. Also they are struct(ures) so to speak.

    A class without methods (functions), only attributes (member variables) is what you seek.

    Code:
    class MyClassIsAstructOrAtype{
     int a;
     String b;
     ComplicatedObject c;
    }
    Java is even fond of saying that everything in Java is a class. So technically, everything in Java is a struct or type.

    In short, every Java app or applet is a struct or type or new class. Notice the .class extension.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width