Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Super Keyword use

 
Yatin Bhor
Greenhorn
Posts: 1
Hibernate Java MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can i use Super keyword in static method or static block???
 
rushikesh kalikar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

super keyword cant call any method.It will call only Superclass constructor.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch

Yatin Bhor wrote: Can i use Super keyword in static method or static block???

I do suggest you to experiment it yourself. in that way you may learn some other things also .
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rushikesh kalikar wrote:
super keyword cant call any method.

using super you can also call super class's instance methods.
this is useful when you have to call super class method in overridden method of subclass.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic