Computer Science, asked by kailashmandal09, 1 year ago

Differentiate between break and System.exit(0).​

Answers

Answered by zephanphilip03
57

break

break is a keyword in C.

break causes an immediate exit from the switch or loop (for, while or do).

break is a reserved word in C; therefore it can't be used as a variable name.

exit(0)

exit() is a standard library function.

exit() terminates program execution when it is called.

exit() can be used as a variable name


zephanphilip03: its the correct answer
mn121: You have answered for C but I think it's of java and you have to differentiate between 'break' and 'System.exit(0);' , not between break and exit() ...
Answered by mn121
44

The word 'break ' is used to exit any loop or any switch case...

System.exit(0); is used to end a program.

Similar questions