× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The syntax "super.init()" calls the init() method of my parent.  This is a 
general procedure when overriding a parent method.  When overriding a method 
(rather than adding your own new method), it's a good idea to invoke your 
parent's method as well, in case it's doing some stuff that you need.  It's an 
especially good idea with constructors:

MyNewClass()
{
  super();   // Call my superclass's constructor
  myInit();  // Do my initialization
}

There are times when you DON'T want to call the parent's method, but you better 
be very familiar with what the parent is doing when you make that decision.

Here's an example I use when I teach: I have a TV class.  The init method turns 
on the TV.  Then I create a VCR/TV combo that subclasses the television.  The 
init method turns on the VCR.  When I call the init method for the new TV/VCR 
object, the VCR runs but I get a black screen - why?  Because I didn't call the 
TV's init routine, which turns on the TV.

Hope this helps.

Joe

---------- Original Message ----------------------------------
From: "Stone, Brad V (TC)" <bvstone@taylorcorp.com>
Reply-To: JAVA400-L@midrange.com
Date: Thu, 8 Feb 2001 07:16:12 -0600 

>Ok, one more question while we're on the subject.  Some of the examples I
see have this:
  public void init(ServletConfig config) throws ServletException
  {
    super.init(config);
  }

Some don't.  I know what the init method is for, but why is it in some
examples and not in others?  And what does super.init(config) do?  


+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.