• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using super method while extending a class  RSS feed

 
Raj kalaria
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get myself a clear understanding of how we use super method

I have one class call AdvSearchEx
i have one method in AdvsearchEx as public void onClickSearch(Button button, ArgumentList args)


Now i havw extended the class as following
--------------------------------------------------------------------------
public class AdvSearchEx extends com.documentum.webcomponent.library.advsearch.AdvSearchEx {
public void onClickSearch(Button button, ArgumentList args)
{
super.onClickSearch(button,args);
System.out.println("Reached Custom class!!");
}
--------------------------------------------------------------------------

Now onClickSearch it self calls some another method define in some another class

Now my question is that
when u execute the code and it reaches to super.onClickSearch will it complete processing (excuting ) every thing f that parent method (that is if parant method calls some xyz method in different class)

and then only the System.out.println(Reached custom class will be type) ?
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried executing it? What happened?

To see where the execution flow goes, add println()s to the code.
 
Raj kalaria
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i have tried

the problem is i am trying to understand the code and "onClickSearch method makes call to another method of some different class"

so according to my understanding of code i thought that System.out.println should be printed after that(onClickSearch method makes call to another method of some different class wherin also i havr typed some println system"

but it does not

May be my thinking is wrong

But generally super.onClickSearch(button,args);
should be excuted first (no mater if it call 100 methods)

just wanted to confirm that
 
Akshay Kiran
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Raj kalaria:
yes i have tried

the problem is i am trying to understand the code and "onClickSearch method makes call to another method of some different class"

so according to my understanding of code i thought that System.out.println should be printed after that(onClickSearch method makes call to another method of some different class wherin also i havr typed some println system"

but it does not

May be my thinking is wrong

But generally super.onClickSearch(button,args);
should be excuted first (no mater if it call 100 methods)

just wanted to confirm that


I suggest you visit the SCJP forum and learn a few things about class initialization, and other stuff about how things work.

And, it would be more helpful if you tried this on a small dummy class, and later on the real ones. Don't try to eat the elephant in day, one bite at a time

If you want more help, paste all the code related and we're here to help you.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think we need some more code to help us understand what you are trying to do. Did you write all of these classes yourself? If so, please post the pertinent code so we can help you understand how it works.

I agree that println() calls will help you see which functions are called. I often add a single println() at the beginning of a method that prints the methods name (and sometimes the parameter values). If, as you say, the message is not printed, then that particular method isn't called. But like I said earlier, we need to see some more code in order to understand why this is happening.

Layen
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!