Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding page implicit object

 
Vimal Sharma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%=page.getServletInfo()%>

Will this run successfully or we have to cast page object

<%=((servlet)page).getServletInfo()%>


i think the <%=page.getServletInfo()%> will run without any error.

Because Method invocation depends on the value of the reference variable not its type.

Please suggest.

Thanks in advance

Vimal
SCJP 93%
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
page is java.lang.Object type and cannot be used to directly call the servlet methods, because getServletInfo() is not a method of java.lang.Object.
 
Vimal Sharma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. Bosun
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!