What are the type of Errors
Programming errors are mainly in three categories; Syntax Errors, Run time Errors and Logic Errors.
Syntax Errors, also known as Compilation errors are the most common type of errors. Most Syntax errors are caused by mistakes that you make when writing code. If you are using the coding environment like Visual Studio, it is able to detect them as soon as you write them, also you can fix them easily as soon as they occur. When you compile your application in the development environment, the compiler would point out where the problem is so you can fix it instantly.
Ex: When you forgot to type a semicolon (;) after the statement, the compiler shows the syntax error and it would point out where the problem occurred.
Run-time errors are those that appear only after you compile and run your code. It will occur when your program attempts an operation that is impossible to carry out. You can fix most run-time errors by rewriting the faulty code, and then recompiling and running it.
Ex: A program error may result from an attempt to divide by zero
When you compile this program, compiler won't show any Syntax Error. But when you run this code, the compiler show "Attempted to divide by zero".
Runtime Errors occurs during the execution of a program that disrupts the normal flow of instructions Exception handling features help you deal with any unexpected or exceptional situations that occur when a program is running. More about.... Exception handling
Your code may compile and run without any Syntax Errors or Run-time Errors, but the output of an operation may produce unwanted or unexpected results in response to user actions. These types of errors are called Logic Errors. That means, Logic errors are those that appear once the application is in use. These are generally the hardest type to fix, since it is not always clear where they originate. Also the development environment does not see anything wrong in the document and therefore cannot point out a problem
Difference between Exception and Error
All the Errors are Exceptions but the reverse is not true. Exceptions are those which can be handled at the run time whereas errors cannot be handled. More about.... Exception and Error
- Can you store multiple data types in an Array
- What is meant by Hash Code
- Is string a value type or a reference type
- Difference between parse and tryparse
- What is anonymous type ?
- Difference between Singleton and a Static Class
- Difference between Properties and Fields
- What does the [Flags] Enum Attribute Mean?