Jump to content

unreachable code in java

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
eman ahmed

eman ahmed

    Learning Programmer

  • Members
  • PipPipPip
  • 79 posts
when the code called unreachable code ?
and why the compiler doesn't reach to it?
by chance , during writing code to program
I write
while(true){
some code
}
any code here called unreachable code
why??????????????????/

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Because the loop will never end. The compiler reaches it, but execution will not.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Stu_328

Stu_328

    Learning Programmer

  • Members
  • PipPipPip
  • 92 posts
put a break in your loop or change the true to a variable that can be changed within the loop.

#4
eman ahmed

eman ahmed

    Learning Programmer

  • Members
  • PipPipPip
  • 79 posts
thanks alot , I got it.