aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What is going on in this code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is going on in this code" Watch "What is going on in this code" New topic
Author

What is going on in this code

Vikas J Yadav
Greenhorn

Joined: Jul 10, 2013
Posts: 16
[Added code tags - see UseCodeTags for details]

Produced Output as
sub static
Superclass arg
Subclass no-arg

I have written a code to call SuperClass satic method; I know that SuperClass static methods cannot be overriden but what happens with this line super(method()); of code
Jack McLaren
Greenhorn

Joined: Jun 17, 2013
Posts: 13

Vikas J Yadav wrote:

what happens with this line super(method()); of code


It will call super class constructor with int parameter.


I AM THE LAW.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4422
    
    8

When you call a static method without qualification it's going to look in the current class. If you want to call the superclass version here you need to qualify it: SuperClass.method().
Gajendra Kangokar
Ranch Hand

Joined: Dec 25, 2012
Posts: 81
    
    1

please use code tags if you want to post any code snippet.
and in your code method() has a return type of int ,so super(method()) passes 5 value to superclass constructor.

Regards
Gajendra
Vikas J Yadav
Greenhorn

Joined: Jul 10, 2013
Posts: 16
Hey Thanks all for quick reply. It solved my doubt

Thanks Gajendra for your suggesion. I will make sure that i wll post the code with proper format

-Vikas
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is going on in this code