Skip to Content
author's profile photo Former Member
Former Member

New Object instance

I have a method call dumpEnvelope,

if everytime i call the dumpPart , i will call the dumpEnvelope,....

if i call dumpEnvelope , i want to create a new object of inMailBean

how do i do that....

previously, what i do is like this...

InMailBean inMailBean=new InMailBean();

only create 1 instance of object...

i want everytime i call dumpEnvelope((Message)p,out,New OBJECT ->inMailBean(),invalidMailAck)

dumpPart(){

dumpEnvelope((Message)p, out, inMailBean,invalidMailAck);

}

dumpEnvelope(Message m, PrintWriter out, InMailBean inMailBean,InvalidMailAck invalidMailAck){

}

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 20, 2007 at 08:15 AM

    Hi,

    If I understood correctly, you want to create new object of InMailBean every time u call dumpEnvelope. If this is correct, then u can do it as follows:

    dumpEnvelope((Message)p,out,new InMailBean(), invalidMailAck)

    Thanks.

    Best Regards,

    Shiva

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 20, 2007 at 08:13 AM

    hi,

    so create new instance of InMailBean in dumpEnvelop() and return if from that,

    cerate new instance with

    InMailBean newObj = new InMailBean(); ///just like how you did earlier

    return newObj;

    so return type of dumpEnvelop() , dumpPart() will be InMailBean, since dumpEnvelop() return this type object to dumpPart() and which in turn return that new obj to calling place. e.g,

    InMailBean dumpPart(){}

    same for dumpEnvelop()

    is that what you were looking for

    let me know if it was smthing else

    regards

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.