How to create an object within the same class???

hi im just a newbie
i v been always creating an object from the main class..
but how to create an object inside the same class??
i got main and students class
the main got an array
Students[] stu = new Students[]
and i got
stu[i] = new Students(id,name);
i++;
but i wanna do these things inside the Students class..
i tried ..but i got errors.....
how to do this
.

javaexpert, :)
I really have no idea what you are trying to do since you say you've always been creating an object from the main class, yet you always want to create an object inside the same class.
I'll assume that you have an object in the main class that you are trying to access from the Students class.
If you are trying to access objects that are contained within the main class FROM the Students class, then know that there are two ways of doing so, one being static, and the other dynamic (look up definitions if unclear):
1.) make the objects in the main class both static and public and access the the objects using a convention similiar to: Main.object; It's important to note that Main is the name of your main class, and object is a static object. There are better ways of doing this by using gettter/setter methods, but I'll omit that tutorial.
2.) Create a new instance of the main class and access the objects using a similiar fashion: Main myInstance = new Main(); myInstance.myObject;
You should really use getter and setter methods but I'll omit the code. In terms of which approach is better, step one is by far.
I don't mean to be condecending, but you should really brush up on your programming skills before posting to this forum. This is a fundamenetal concept that you will encounter time and time again.

Similar Messages

  • How to create multiple objects within a class

    I have a item.lvclass which has an item.ctl (contains a cluster of class private data).  I need to add another object (item2.ctl) within that same class so that I can reuse the code for that class.
    So how do you create additional objects within the same class?

    Well... right now...  I've cornered myself going down this path:  http://forums.ni.com/t5/LabVIEW-Idea-Exchange/LVOO​P-Interfaces/idc-p/1314637#M8918
    Seems like the solution in the idea was not implemented yet....
    Okay.  I will try to describe the situation differently...
    Let's say I have a Car.lvclass
    I want to have two objects:  sedan & roadster
    both have similar properties, but also have different properties:
    4 doors vs 2 doors
    hardtop vs convertible
    silver vs white (color)
    I want the two objects to be of the same class so that they can share the same private and public VI's.  As a matter of fact, I want to have both objects in the VI's within the Car.lvclass.

  • How to create many user in the same database

    hi
    my question is "How to create many user in the same database(application)?"
    for example, i have students, teachers, and staffs user using my application.
    i can create many users to use the same application right?, how ^^''' ???
    (right now i can only create application and then it shows every data in my DB
    but i want it to show only the data for the user who login to that application)
    Thanks.
    ps. i'm newbie, please help T^T

    You need to create a user table within your application that maintains their privileges. If you have LDAP you could use this for authorisation otherwise the table would handle that as well (store passwords etc). Your reports etc would then be filtered on information from this table.
    Check out some of the sample applications to see how authorisation and access is implemented (Online store is one). The how-to on the issue tracking system should also have some useful pointers.
    http://download-west.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28839/issue_track.htm#BABBGBJG
    cheers,
    Ron

  • How can I POST data within the same page if I have a A HREF -tag as input?

    How can I POST data within the same page if I have a <A HREF>-tag as input? I want the user to click on a line of text (from a database) and then some data should be posted.

    you can use like this or call javascript fuction and submit the form
    <form method=post action="/mypage">
    cnmsdesign.doc     
    </form>

  • How to create an object of our own class by using Class.forName()??

    how to create an object of our own class by using Class.forName()??
    plzz anser my qustion soon..

    Class.forName does not create an object. It returns a reference to the Class object that describes the metadata for the class in question--what methods and fields it has, etc.
    To create an object--regardless of whether it's your class or some other class--you could call newInstance on the Class object returned from Class.forName, BUT only if that class has a no-arg constructor that you want to call.
    Class<MyClass> clazz = Class.forName("com.mycompany.MyClass");
    MyClass mine = clazz.newInstance();If you want to use a constructor that takes parameters, you'll have to use java.lang.reflect.Constructor.
    Google for java reflection tutorial for more details.
    BUT reflection is often abused, and often employe when not needed. Why is it that you think you need this?

  • How to use multiple profiles within the same instance of Thunderbird

    About a month ago, I had Thunderbird configured with three profiles,
    and all three could be used within a single startup/instance of
    Thunderbird. That PC is now gone. I have re-configured the three
    profiles on a new PC, but am having trouble making all three
    useable within the same instance of Thunderbird. Can you help?
    Both PCs are/were Windows-7 64 bit.

    Thunderbird only opens on the default if one profile
    or
    if Profile Manager is instructed to ask at startup it will allow you to choose which Profile to open else it opens on the last Profile used..
    So it shows one Profile at a time in one instance of Thunderbird.
    However, one Profile can have many mail accounts.
    eg: I run 4 mail accounts in one Profile.

  • How to create reports servers with the same name in two nodes in Reports

    Greetings
    We are migrating Oracle Application Server 10g (9.0.4) to a better hardware infrastructure with high availability. We want to provide 2 new Oracle Application Server 10g (9.0.4) in High availability and we want to avoid modify the existing forms and reports code, but the code is looking for a specific reports server name when calling reports, but I couldn't create the same reports server name in the both oas machines, I could create the reports server in only one node. I want to create a reports server with the same name in both nodes but it is not possible. I know that there is a procedure to do that in 10.1,2 (Note 437228.1, How to Create Two Reports Servers With the Same Name in the Same Subnet) but I couldn't find the equivalent procedure in 9.0.4.
    Anybody kwows how to create a reports server with the same name in two nodes using 10g (9.0.4)
    Thanks
    Ramiro Ortiz.

    Hello.
    I applied the patch 4092150 on my oas 9.0.4.2 and I modified my rwnetwork.conf file changing the port to 14022 by following the note "How to Create Two Reports Servers With the Same Name in the Same Subnet? [ID 437228.1]" but I am facing the same error rep-56040 "server already exists in the network".
    When I run osfind command I get the following information (My reports server is senarep and I want to create it on SNMMBOGOAS10):
    osfind: Found 2 agents at port 14000
    HOST: SNMVBOGOAS10.sena.red
    HOST: SNMVBOGOAS09.sena.red
    osfind: There are no OADs running on in your domain.
    osfind: There are no Object Implementations registered with OADs.
    osfind: Following are the list of Implementations started manually.
    HOST: SNMVBOGOAS10.sena.red
    REPOSITORY ID: IDL:oracle/reports/server/EngineComm:1.0
    OBJECT NAME: senarep2
    REPOSITORY ID: IDL:oracle/reports/server/ServerClass:1.0
    OBJECT NAME: senarep2
    HOST: SNMVBOGOAS09.sena.red
    REPOSITORY ID: IDL:oracle/reports/server/EngineComm:1.0
    OBJECT NAME: senarep
    REPOSITORY ID: IDL:oracle/reports/server/ServerClass:1.0
    OBJECT NAME: senarep
    Any Ideas?

  • Help!! How do you keep objects in the same order in a 20 page doc when inserting a new object?

    I am creating a catalog of pictures only, as objects.
    They are organized alphabetically, 4 images per page as a 2x2 grid, for 20 pages.
    I want to insert a NEW object (image) in the middle of these 20 pages, and want all the objects after it to shift over one spot to make room.
    How do I get the objects after the inserted ones to shift, as text would if you inserted more text in the middle of a paragraph?
    I can't figure out how do do that (without just putting the images in a text box and in-line, but then I lose all the spacing controls)...
    Thank you!
    Lawrence

    ID ships with a free Image Catalog script in the sample scripts. You don't need to buy one.
    And that isn't going to do what you want, exactly. You'd have to re-run the script each time you add an image to make a new file, and you don't get to set the sort order yourself.

  • How to always rotate objects around the same point, even using the right-click menu?

    I need some of my objects to always rotate around the same point. How can I select a point which will stay that way?
    Using the rotate tool resets after deselecting.
    Also, I'd like to rotate objects around a certain point even when using the right click > Transform > Rotate.
    Is it possible?

    Right, so this is where Illustrator falls short with respect you your need, but only in the sense that the reference point can't be made to stick. You can, however, use Smart Guides to make it so the point is easy to set at exactly the same location, (especially since your object has an anchor point there), manually before each rotation.

  • How to create connection objects in the NTDS settings container of a DC with LDIFDE

    The following link shows some examples of how to automate creating subnets without having to use the sites and services console: http://codeidol.com/active-directory/active-directory/Site-Topology/Creating-a-Subnet/
    My question is how can use LDIFDE to create connection objects? We don't use the defaultipsitelink and are creating the connections manaully. How can I use LDIFDE to create connection objects like this? I have not been able to find any examples on the internet.
    Thanks for any replies.

    KCC does the job of creating connection object automatically reading site/subnet/sitelink info, so why you need to create manually.
    http://blogs.technet.com/b/markmoro/archive/2011/08/05/you-are-not-smarter-than-the-kcc.aspx
    Regards
    Awinish Vishwakarma
    MY BLOG:
     http://awinish.wordpress.com/
    This posting is provided AS-IS with no warranties/guarantees and confers no rights.

  • How to create multiple copies of the same mailing label?

    I know how to create mailing labels for addresses in my address book. How do I print an entire sheet of the same address on a page of mailing labels? The preview when I select 20 copies of one address label does not show the same label on multiple times on the page, only once. Does that mean it will only print one label per page for a total of 20 pages or does it only show one since they will all print the same?
    I'd like to use this to create custom return address labels

    It's tedious but you can create a new group in Address Book, make 20 entries (or however many entries would make one label page's worth) for your own name and print just that group.
    Avery has free software that I believe does what you want but I haven't used it. Comments on the download page indicate the Avery software lacks on directions.
    http://www.avery.com/avery/en_us/Templates-%26-Software/Software/Avery-DesignPro -for-Mac.htm?N=4294967076&refchannel=3980ac83ae70a110VgnVCM1000002118140aRCRD

  • How Can I open Report within the same window instead of separate Window

    Hi All,
    I want to open report in my MDI form instead of opening it into a separate Oracle Report Navigator(i.e. Window which shows the report). How to do that? When I click the Report from Menu it should open it within the MDI Form. Any suggestion or reply would be greatly appreciated.
    One more question is how can i open report with in a maximized state. Actaully, the report will be opened in the normal state. How to open in maximized state instead of normal state. Is there any property in reports to acheive this?
    Thanks in Advance.
    Regards
    Gopinath Kona

    hello,
    reports is a separate application that is called from forms and therefore is running outside the context of the forms MDI window.
    you can use the commandline parameter MAXIMIZE=YES to start the runtime in full-screen-mode.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Create another object using the same container generated by a split...

    Hi SapGears!
    I'm facing a problem about creating an object using a splited container.
    I split the container A in containers A1 and A2 and create alv in A1 and html in A1.
    After that, i need to create a toolbar buttons using the class cl_gui_toolbar in A2 without need to recreate all again.
    I Try to call method free( ) and recreate the object, but the container A2 appears in blank.
    any help will be very nice!!!

    I would try different solution. Split A2 into two new rows B1 and B2. In B1 set your toolbar, in B2 your alv. By default set B1 cell hidden
    "suppress splitter bar
    CALL METHOD gr_splitter_cont->set_row_sash
        EXPORTING
          id    = 1
          type  = gr_splitter_cont->type_movable
          value = gr_splitter_cont->false.
    "show only alv in entire cell
      CALL METHOD gr_splitter_cont->set_row_height( id = 1 height = 1000 ).
    Now when you request for toolbar display only that cell
        CALL METHOD gr_splitter_cont->set_row_height( id = 1 height = 0 ).
    A kind of workaround but you will avoid much troubles.
    Regards
    Marcin

  • How to create lock object  when the total length is more than 300bytes?

    Dears:
    I want to create lock object for a add-on table , and the total length of  table's fields is more than 300 bytes.
    When I acitve this object, it will show "Total length of lock argument for table ZTEST_XXX longer than 300" error message in log.
    Is there any way  which can create  lock object when total length > 300bytes? 
    Thanks in advance.
    Best regards
    Lily

    Hi, Sudhi Karkada Sandeep Kumar 
    Thank you very much for your help.
    When the total length of  keys is more than 150bytes, lock object can't be created.
    Best regards,
    Lily

  • How to typecast an object, if the target class name is stored in a str var

    Hi,
    I have a method, in which i will receive an object as an attribute. I need to typecast it to another class, and that class name is stored in a string variable.
    public void printContent(Object obj)
    /* Here i have a variable strClassName - in which a class name is stored.
    I need to create a variable for that class and type cast the object obj into that class. */
    Please kindly help me to find out a way to do this.
    Thanks in advance

    Typecasting does one thing: it enables you to store an object in a reference variable of the target type (if it is of a type which is allowed to be in that variable). It doesn't alter the object in any way.
    Therefore it simply isn't meaningful to talk about typecasting to a type name known only at run time. The whole point of typecasting is to tell the compiler to treat a reference as being of a specified type.
    I don't know what you're trying to do but I think you should probably be looking at the reflection api, getting field an method information from the object's Class object.

Maybe you are looking for

  • Secure link to iTunes Store Failed using XPSP3

    I cannot log into the iTunes store. When I run diagnostics it indicates Secure  Link to iTunes Store Failed. It does not appear to be my related to McAfee security software as the issue remains when the file wall is disabled. I have following the tro

  • Itunes wont even launch. i removed program and downloaded new copy, still wont lauch

    itunes will not launch. it used to work on this pc. i uninstalled it, downloaded a new copy, and tried again. still won't work. help. and thanks.

  • How to suppress bars on chart and customize legend text

    I am new to Crystal Reports and have a couple of questions about bar charts.  I am using Crystal Reports XI Release 2 with Developer Studio 2005 (C# .NET) and SQL Server. I have a very simple report that sums up the values of 14 different database co

  • Class display objects visible=false

    Hi there, I have an app that displays XML as items. I am taking the createLayout() and trying to create a class that i can call from my custom component rather than having tons of code in the same file. The issue i am having is that when i call it, a

  • AS3_Function versus AS3_FunctionAsync

    These two API functions are documented as creating a "synchronous" and an "asynchronous" function callback object. What is the difference between these, and where can I read more about it? I asked our local ActionScript gurus, and they said it was no