GoTo statement in Java



Q) GoTo statement are not available in Java why?

Rep)

1) Goto statement decrease readability of a program.

2) Goto statement may from Infinite loop

3) Goto’s are not part of Structured programming

4) Goto statments make documentation difficult.

A goto statement can cause program control to end upalmost anywhere in the program,for reasons that are often hard to unravel ,However almost always, there is a more elegant way of writing the same program using if,for,while and switch. These constructs are far morelogical and easy to understand.

This is seldom a legitimate reason for using got, and its use is one of the reasons that programs become unreliable, unreadable.

Random Posts

  • Define HashSet Class
  • Define Session Tracking in HttpServlet
  • Difference between session.save() , session.saveOrUpdate() and session.persist()
  • Swings Interview Questions
  • when do use application scope

Post a Comment