|
| ||||||||||
| Tags: call destroy method, call init method, destroy method, init method, servlet methods |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Is it possible to call destroy() method within init() Method?
I am IT student, I want a solution over confusion of advanced java. I have basic idea about the servlet. As we know that servlet life cycle starts from the init() method and life cycle can be ended using the destroy() method. But my question is that, Is it possible to call destroy() method within init() Method? and if we call destroy() method what will happen? Please let me know solution to sort-out this confusion regarding the destroy() method. |
|
#2
| ||||
| ||||
| Re: Is it possible to call destroy() method within init() Method?
Hi, Basically init() method essential to open the connection for the servlets and on other hand destroy() method is used to close the different connection which is initialized by the init() method. In servlets of the advanced java it is possible to call destroy() method within init() method. But difference is that if you executes the java program, the body of the destroy() method will execute first, then body of the init() method will execute. |
|
#3
| |||
| |||
| Re: Is it possible to call destroy() method within init() Method?
Hi, Following are some possibilities with destroy() method: *. If you invoke default method of the destroy() within init() method, it won't affect with functioning of the init(). *. If you invoke destroy() method within service() method, It also won't affect with functioning of theservice() method. *. If you try to override destroy() method, It doesn't affect these init() method. |
|
#4
| ||||
| ||||
| Re: Is it possible to call destroy() method within init() Method?
Why not? you are able to invoke the destroy() method of the java into the java init() method. In below example I included the destroy() method immediately after the calling of the init() method. Even though it didn't affect the init() calling: Quote:
|
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Is it possible to call destroy() method within init() Method?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Method overriding versus method hiding in C# | ^MALARVIZHI^ | Software Development | 4 | 25-12-2010 05:25 AM |
| How can I call VBA method dynamically? | opaper | Software Development | 5 | 28-01-2010 08:25 AM |
| What is method overriding and method overloading in java | beelow | Software Development | 3 | 17-11-2009 07:20 AM |
| Java: How can I call one method in another method? | biohazard 76 | Software Development | 3 | 16-07-2009 07:12 PM |
| Method call of another Project | Mahendra varma | Windows Software | 2 | 22-04-2009 03:40 PM |