I am using Eclipse and progamming in java. obviously i want to avoid infinite looping, but what about when a program simply crashes, and it shows me the error? Is that bad for my 1.8Ghz Intel core 2 duo with 2GB ram, every time a program crashes? for example I have a buffered reader that accepts input and then i convert parse it to integer and print; but if the user enter a letter, the program crashes.
Does a java program deal damage to your computer when it crashes?
If you're using Windows (any version) it could.
Windows uses what is called cooperative multitasking. In other words, it makes applications share memory space with other applications. It's not truly multitasking; think of it as dealing cards - the processor and memory both deal out of their own deck to all of the running processes in their turn. No application has its own memory space. If one process crashes, it affects all of the others because that "turn" is still dealt out but it is dealt out to no process. Very quickly this can bring down ALL processes.
*nix (Unix and Linux and yes, Macintosh) use what is called preemptive multitasking. What this does is create separate, unique memory spaces for each of the processes running. The nice thing about this is that when one process fails it does not affect any other independent process (there are some processes that are completely dependent upon others; e.g. a print job is completely dependent upon the print spooler daemon running). The nice thing about preemptive multitasking is that when one process is shut down it does not affect any of the other independent processes.
Reply:Java programs deal 1d20 when they crash!
Seriously though, your computer is fine. If a program crash caused computer damage everytime, there would be alot less computers out there now.
Reply:Billh's answer is plain WRONG, it was true in the 16 bit windows days but there is no way it is true for modern windows.
Reply:No, stay calm. It doesn't do any damage to your computer. Why don't you just your Integer.parseInt part of the code in a try catch block and catch the NumberFormatException? That will prevent crashing.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment