How do I make an instance of another class??

How do I make an instance of a class, (eg. the name of the class is oldJava.class and have a constructor that takes 3 parameters)in a new class. and send paramaters to the oldJava.class constructor. I also want to recive the result from oldJava.class in my new class.
??I would be really glad if I could get some code example.....
//HA

oldJava o = new oldJava(..., ..., ...); // your arguments here
o.method1(); // you can call methods on this object now
// If the method returns anything back, you can keep a reference to it
int result = o.sum(2, 5);

Similar Messages

  • How do you make an appointment in another time zone with IOS7?

    How do you make an appointment in another time zone with IOS7?

    Not clear how you want to set them - in your time zone or "another" time zone.
    Settings > Mail, Contacts, Calendars > (scroll down to Calendars) > Time Zone Support > ON/OFF (depending on how you want it)

  • How to get a int value from another class method?

    Hi,
    how can I get a value of another class method variable value.
    example,
    class elist
            int a;
         ArrayList<Event> eventArray;
         void addEvent(Event e);
         Event getEvent(int index);
         void removeEvent(int index);
         void orderEventByTime();
    interface Event
         void Command();
    class servo implements Event
         String ip;
         int time = 10;
         void Command();
    class servo_2 implements Event
         String ip;
         int time = 20;
         void Command();
    [\code]
    I want to get the time value in elist variable a; 
    and want to compare each class time?.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    1) this foum provides means to format/tag code, no need to manually add -tags
    2) by default, classname start with a capital letter, method names with a lower case letter
    3) where do you want to get the time value to Elist.a? During addEvent()?
    4) what do you want to do with the time value of each event? Sum all values up to make a an overall sum?
    5) where do you want to compare the time value(s)?
    To put it in one sentence: please be more specific with your description and answer.
    Bye.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How do you call a method from  another class without extending as a parent?

    How do you call a method from another class without extending it as a parent? Is this possible?

    Why don't you just create an instance of the class?
    Car c = new Car();
    c.drive("fast");The drive method is in the car class, but as long as the method is public, you can use it anywhere.
    Is that what you were asking or am I totally misunderstanding your question?
    Jen

  • Creating a Set  containing instances of another Class, which type?

    Hi All,
    I'm stuck trying to create a set which contains instances of another Class.
    When I created my instance method, it takes an argument which is the instance of another Class.
    It errors as I've used the Class as the type rather than String> or Integer.
    Can someone point my in the right direction?
    WebPageData wpd1 = new WebPageData("this is a sentence for a test", "www.test.com");
    WebPageData wpd2 = new WebPageData("this sentence is shorter", "www.short.com");
    WebPageData wpd3 = new WebPageData("this is very short", "www.very.com");
    Finder f1 = new Finder();
    f1.addsite(wpd1);
    f1.addsite(wpd2);
    f1.addsite(wpd3);
    f1.searchFor("a sentence test");
    Edited by: geedoubleu on Mar 16, 2008 9:03 AM

    The error message is "Semantic error: line 5. Message addsite( WebPageData ) not understood by class'Finder'"
    * Adds the argument of WebPageData instances to to a collection scannedSites.
    public void addSite(WebPageData theWebPage)
    this.scannedSites.add(theWebPage);
    }

  • How can I make the Instance name the same as the name of the Movie clip in an animation.

    Hi, I am an animator for a small game project and I have this really big problem. Even though I used flash for animation for a long time I am a newbie when it comes to something technical. I just received a request to make every movie clip that I use  to have a consistent <Instance name> in every frame of the animation. Only if they told me this earlier... Is there an easier way to make the <Instance name> the same as the name of the Movie clip used other than manually entering it. I have 16 characters with 12 body parts with 20 animations each with about 6-7 frames for each body part it will take me months and nightmares evey night to enter everything by hand. Please help me keep my sanity!
    I'm not sure if I explain correctly, so here is a picture:
    Thank you!

    Thank you for the fast answer! I found this video on jsfl functionality that deals with a similar problem, I am not a coder so it will take me some time to figure it out, but when I do I will probably post the answer here. Here is the video:

  • How to add objects to panel from another class?

    Hi this is what i am trying to do. I have a drag and adrop tool working where the users and select objects on a small panel and drag them to another panel called the tpan. What i want to do is create another class, which creates objects and now i want to display these objects on the tpan. So say i have a class DisplayTpan(), this class is used to display the objects which have been dragged from the small panel, and objects on this panel have mouselisteners attached, so that these objects can be moved around on the tpan. I have created another class called creatObj(), and from this class i want to add objects to the tpan. The DisplayTpan class extends a Jpanel, would this be he case for the CreateObj() class? In the CreateClass i have made a call to DisplayTpan t = new DisplayTPan();
    t.add(object);
    But this does not add the object to the panel, any ideas on how it should be done?
    Problem number two i have is say, I have two objects created on that oanel, i now want to draw a line t connect the two objects, this is just simply a call to the drawLine function but how would it be possible to add a ,mouselistener to that line, so it can be extended moved around etc? Any help much appreciated thanks.

    As for your first problem...too confusing...too tired...mb tomorrow it will make sense :)
    Fer the second...no need to add a mouse listener to each line. There are a couple options that spring to mind, the easiest I can think of is just check to see if the mouse click intersects with any of the lines (bit of geometry).
    The second, ugly but a hella allot more accurate and better (me thinks), is to create a bounding box around the line, so the user doesn't have to click right right on the line. I created this bounding box by painting the pixels with a special key to correspond to that line. The other nice thing about this key is the fact that the lookup is quick.
    The first step was the create a array of integers the size of the surface. Whenever a line is drawn on the graphical surface, do a corresponding line in the integer array, and create the bounding box inside this invisible array. Now whenever the user clicks just do a lookup into this array and check to see which line was selected...then go to town.
    If you want a more detailed explination, i'll post some code later.

  • How can I write an instance of a class in a static variable

    Hi !
    I have an instance of a class
    Devisen dev = new Devisen();
    In an other class I have a static method and I need there the content of some variables from dev.
    public static void abc()
    { String text=dev.textfield.getText()
    I get the errormessage, that the I cannot use the Not-static variable dev in a static variable.
    I understand that I cannot reference to the class Devisen because Devisen is not static I so I had to reference to an instance. But an instance is the same as a class with static methodes. (I think so)
    Is there a possibility, if I am in a static method, to call the content of a JTextField of an instance of a class ?
    Thank you Wolfgang

    Hallo, here is more code for my problem:
    class Login {
       Devisen dev=new Devisen();
    class Devisen {
       JTextField field2;
       if (!Check.check_field2()) return; // if value not okay than return
    class Check {
       public static void check_field2()
         HOW TO GET THE CONTENT OF field2 HERE ?
    One solution ist to give the instance to the static function, with the keyword "this"
    if (!Check.check_field2(this)) return;and get the instance
    public static void check_field2(Devisen dev)BUT is that a problem for memory to give every method an instance of the class ? I have 50 fields to control and I dont want do give every check_method an instance of Devisen, if this is a problem for performance.
    Or do I only give the place where the existing instance is.
    Hmm...?
    Thank you Wolfgang

  • How To Pass the Request Scope To Another Class

    In my ListThread class, I first retrieve some of the text fields; i.e., request.getParameter( ... );
    Thereafter, I want to pass the request scope together with some parameters to another class; SiteUtil.java., for some further processing. This is what I do:
    public final class ListThread extends HttpServlet
          public doPost( HttpServeltRequest request, HttpServlerResponse response)
                      throws ServletException, IOException
          String offset = request.getParameter( "offset" );
          String size = request.getParameter( "size" );
          SiteUtil.prepareNavigate( request, offset, size,
               MessageInboxConfig.ROWS_IN_THREADS );
    }This is my SiteUtil.java:
    import javax.servlet.http.HttpServletRequest;
    public class SiteUtil
       public static void prepareNavigate  
         (HttpServletRequest request, int offset, int   
                         collectionSize, int totalRows)
          int startOffset = offset + 1;
          int lastOffset = offset + collectionSize;
          request.setAttribute("StartOffset", new Integer(startOffset));
          request.setAttribute("LastOffset", new Integer(lastOffset));
    }Can I pass the request scope and save attributes in the scope this way?

    You can pass the request to that method as a parameter, yes, and you can even modify the request there. The request is just an ordinary Java object, so ordinary Java rules apply. Your code looks fine to me too.
    However don't try to store the request for future use, since after the response is sent back to the client, the request object is never used again. A new one is created for the next request.

  • How can I make parallel Instances of a VI, avalible through webserver URL?

    Hello, I have a vi that I want multiple people be be able to access at the same time through the web.  Each time a client accesses the URL I want the VI to start a new instance in paralles for them.  So if 5 people went to the URL each would be using their own independent parrallel instance.  I dont want them to be able to see what the other is doing.  Kind of like if you start solitare then click its .exe again it starts another seperate instance of it.  I tried using reentrant execution still showed to the second client that the .vi is controled by someone else, even attempted making it a sub-vi called by a main but i would have to make the main one the .html and it wont display the sub vi's in the webpages embeded window.  
    Any Ideas?
    Thanks In Advance
    I'm running :
    Windows XP Pro. SP3
    LabView 8.0

    I did this once using CGI in combination with a VIT. the CGI server would open this VIT and create the dynamic web page to show this VIT to the user by using remote panels. So each user had its own anstance of an remote panel.
    To explain it in details:
    the index.htm would have a POST command in it that will trigger when the user opens up the web page. This post command informs the CGI server. The cgi server then creates a VIT in memory, and creates a dynamic html code that is sent back to the user, (this code would be the html code for a remote panel) but where the VI name that is shown in the remote panel will be the same as the new name that the new VIT got in memory.
    Remember also to shut down the VIT when the user closes its browser, otherwise you'll going to have a lot of VIs in memory after a while!
     If any questions just ask, you could actually also use datasocket to retrieve the post command.
    On tip: the CGI part of labview runs in an own instance. You must link the VIT you your main application instance for it to be able to communicate and share data with your main apllication by using VI server. (weird sentence..)

  • How do I make Screen Instance Groups?

    I'm not talking about simply making a layer folder with various elements grouped inside. What I'm trying to do is create different screen instances of a website using a feaure that turns on specific layers, allowing me to save that "layer visible" combination. I did this a few years ago and now cannot remember how it was done. To give an example:
    I have a layer folder called "main navigation" in my Photoshop file. This main navigation folder has tons of sublayer elements that include the menu itself,  hover states, drop down states, etc. I have another layer folder that contains elements for a specific web page.
    What I used to do was this: I could turn on one of the specific web page folders, then turn on the active state element in my Main Navigation folder. So now the page looks as if it would for that specific screen instance. At this point, I was able to create a "Layer Group" that saved this specific set of layers that were turned on (visible), and name it.
    Does this feature still exist in Photoshop? I can't seem to find it anywhere, or find any documentation on how to implement it.

    It sounds like you're referring to Layer Comps, which you can turn on by going to the main menu Window>Layer Comp.  I'm not sure how well this will work the the new Generator feature.  I've asked about it, and all I was told that it's a bit sticky trying to get Generator to work with Layer Comps.  But that doesn't mean that they won't come up with a way for it to work.

  • How can I make a member of one class accessible from another class?

    I thought by making a data member protected it was available to all members of the package, but the compiler is giving me an error. If I put the class name dot the data object it thinks it is a function and gives an error.

    I can't post actual code or I'll get in trouble.
    I can't create an instance of A because the class
    needing to call the structure is a Thread and there
    will be multiple instances of it.
    I need one solid structure and it can't be static
    because it has to be ablet o change.So you can't use a static and you can't use an instance. So how exactly do you ever access A?
    BTW you are describing the impossible so you need to take a deep breath and give an explanation that makes even a modicum of sense. Hint: what you have described thus far is nonsensical enough that nobody is going to want to steal your precious code trust me.

  • How can I install ASM instance in another oracle home?

    Hello:
    I have installed Oracle 10 g R2 software at a oracle home,and have create a database with an instance named ocafs withou ASM,now I want to install ASM instance and create a new database using ASM,how can I insure that the ASM is installed in it's own oracle home by using dbca or some other tools? And can I specify the instance name of the ASM?
    Thank you very much!

    Use the oui.exe (Universal Installer), it checks for existing homes. Based on what you want to do (create a new db with ASM), OUI is smart in that in will not let you create it in an existing home. It will prompt for a different location if you try to use an existing home.
    Good luck

  • How do I make a link to another webpage open in a new window?

    Hello Everyone,  I am at a loss as to how to do this.  I'm not a developer, just someone who updates simple things on my website.  I thought I took care of this a couple of weeks ago, but whatever I did it does open the link in a new window while opening it in the window my site is in too, which defeats the purpose.  I can't find how to correct this in Help.  Any help would be greatly appreciated.  Pamela

    Select the text you want to open the pop up window
    In the Property Inspector,                         type javascript:void(0) into the Link field.
    http://www.cbtcafe.com/dreamweaver/popup_text/index.html
    Additionally, you have quite a few code validation errors on your page that are caused by using XHTML strict document type with HTML style closures. You may want to fix these.
    http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.theeleganttightwad.com%2FEffo rtlessSavings.html
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb

  • How to refresh one View instance from another View Instance

    Hi ADF Experts,
    I have a requirement in which I have created two View Objects based on a single entity object.
    I am using a first VO to display data in a table and the second to update data to database.
    The commit will happen through a Global save button.
    But before the global save, I need to show the data using the First VO, which is inserted using the second VO.
    Can anyone help me on how to refresh the first VO to display the data.
    Thanks in Advance
    Mohan
    Edited by: 946185 on Mar 29, 2013 4:24 AM

    Hi Dileep,
    The first VO which I mentioned is based on two EOs and has a lot of calculated values.
    And to add to my worries there is a parent child relationship between the two EO's, where in parent is updated with one row and child with multiple rows.
    The multiple rows updation to the child should happen with a shuttle component in a different popup.
    So I am inserting everything programatically in the java code, where I need two use different VO to update parent and different VOs for the shuttle.
    I could get the data, if it is committed, but to add to the complexity, there is a global save button which should commit the data.
    So I want to get the data based on the EO update before commit to the database.
    Thanks
    Mohan

Maybe you are looking for

  • How to Print PDF Format In SAP SCRIPT

    Hi All, I have a requirement to print the output in PDF format. First we can pass the parameter from Excel sheet,through on the parameters , we can fetch the output and print the PDF format. Please help me. regards raghava

  • What's wrong with my MBP???

    I'm getting the beachball frequently when using Safari and Microsoft Office. At times the beachball doesn't go away for even 1-2 hours, so now I have to frequently hold the power button to reset it. Sometimes when I reset it and get to the start up s

  • How can I rearrange photos within album in iPhoto 9.5

    I used to be able to do this in older iphoto applications. I have gone to View and checked manual and I still cannot arrange the photos within an albun manually.

  • Start and stop data saving while running the vi

    Hi everybody! Maybe someone can help me on this topic: I would like to run a vi which displays voltage values on a waveform graph without saving the values automatically. But - while running the vi - I would like to have the option to save the data.

  • Restarting the MS Exchange Information Store

    Exchange 2013 SP1 with 2 member server DAG. We installed the 2nd member server product key and need to restart the information store. What is the proper way to restart the information store with a DAG? The dag member that needs to have the informatio