Results 1 to 4 of 4
- 01-22-2009, 12:17 PM #1
Diference Between compiler error Garbage collection and Runtime Error?
Hello java lovers
......................
i am mak .i have one big thread in my mind about java programming?
i don't know how java errors are classified into compiler error ,garbage and Runtime error?
any one can explain about that in simple manner?
Regards
makpandian.
- 01-22-2009, 01:28 PM #2
Don't consider gc, I tested it recently - it should be removed from api.
Compiler errors are things you are told about when you try to write the code, runtime errors ( and exceptions ) are things that error while the program is ( supposed to be ) running.Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 01-22-2009, 05:36 PM #3
Garbage collection is something the runtime does in the background, which reclaims unused memory. It has nothing to do with errors.
Compiler errors are generated when the compiler takes your source and attempts to turn it into byte codes. If error occur, then the compile process fails.
Exceptions are errors that occur while the program is running. Normal exceptions are things that the programmer anticipated and must explicitly either handle or say that the method will not handle them. Normal exceptions are things like "Connection refused by host". The programmer knew that the host could refuse the connection, so explicitly declares an exception for it.
Runtime exceptions are special exceptions that the programmer did not anticipate. "Null pointer exception" is a good example.
One note: In a block, only normal (not runtime) exceptions will be caught. If you want to catch *everything*, use try{} catch(Throwable t) {}.
Look at the API for Throwable, Exception, and RuntimeException.
- 01-23-2009, 09:53 AM #4
Similar Threads
-
Help Finding Compiler error solution please
By jamesr2b in forum New To JavaReplies: 5Last Post: 04-30-2009, 07:07 AM -
How setting an Object to null help Garbage Collection?
By piyu.sha in forum Advanced JavaReplies: 3Last Post: 10-06-2008, 08:35 AM -
Compiler Error
By jeneal in forum New To JavaReplies: 5Last Post: 12-13-2007, 02:31 PM
Bookmarks