0

Can i use goto statement to jump from one method into another in c++ , java or c#.

Eljay
  • 941
  • 5
  • 15
  • 30
  • @ShashankKadne: That is incorrect, C++ does not support `goto` jumping between methods. – Greg Hewgill Feb 25 '12 at 07:10
  • @GregHewgill: I can't even label a method and then call goto to jump to that label??....i never tried it! – Shashank Kadne Feb 25 '12 at 07:14
  • 1
    @ShashankKadne - no you can't. Try it. The compiler won't let you. And in the Java case, `goto` is not supported because the designers thought it was a bad language feature, not because of any real or imaginary security concerns. – Stephen C Feb 25 '12 at 07:19
  • Thanks folks...that means my comment makes no sense. I should better remove it. – Shashank Kadne Feb 25 '12 at 07:23

3 Answers3

2

Not with java. goto is a reserved word (statement) but it is not useable by design.

Further reading:

Community
  • 1
  • 1
Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
1

Not in C#. It is possible to jump inside one method though.

ogggre
  • 2,204
  • 1
  • 23
  • 19
0

In VB6 goto statement is used to jump some where inside the same method.

Sukanya
  • 1,041
  • 8
  • 21
  • 40