• Post Reply Bookmark Topic Watch Topic
  • New Topic

Polymorphic Arguments  RSS feed

 
Niyas Ahmed Sheikh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have tried the below sample coding to know how the polymorphic arguments are working.



By the above coding, I'm not getting any error.

But the below codings, raise the error. Just I have included the System.out.println statement to know the flow of thr pgm.



Any other advise/desc/hidden facts about the polymorphic arguments are WELCOME!
 
Niyas Ahmed Sheikh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry..forget to give the error message

And here we go!!!




















































 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Niyas Ahmed Sheikh:
Just I have included the System.out.println statement to know the flow of thr pgm.


You can't have statements like that. The statements should be present inside a method, or a constructor or a static block...

For example, you should change your Manager class as
 
Steve Simon Joseph Fernandez
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Executable statements (in this case, System.out.println()) have to be placed inside a method. Put your println's inside the class constructor.

_steve.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!