SlideShare a Scribd company logo
I believe the three types of errors you can run into with a Java program consist of:

1. Syntax Errors
2. Semantic Errors
3. Logic and Runtime Errors

A syntax error is an error that violates the coding rules for the Java language (or
any language for that matter). I believe the most common syntax error, and
speaking from personal experience, is forgetting the end bracket to a statement.
Other common syntax errors include forgetting a semicolon. Forgetting a
semicolon at the end of a statement could potentially cause multiple errors. The
best place to start correcting these errors is with the first one detected in the list, as
it will probably clear other errors out. A great way to combat this problem is to
have a methodology in how you write your code. One habit I've gotten into, is after
I type out a starting bracket for a statement or method, I immediately hit enter a
few times then put the end bracket in. Once I do that I will move my cursor back
up between the brackets and start typing out the logic of that statement.

A semantic error in simple terms changes the meaning of the code to the compiler,
confusing it. I think the most ubiquitous source of these errors (for me) is
inadvertently messing up the names of variables. I tend to follow a specific naming
schema, so all my variables are usually upper-case first word, upperclass second
word, etc. For instance, SalesTax, or EmployeeFirstName, would be my variables.
With that said, I have ran into error issues because I might type a variable
incorrectly like salesTax and it produces an error. I believe only way to prevent
errors (if possible) is to follow a strict naming rubric and maintain attention to
detail as you pound out your code.

The last error is a logic and/or runtime error. These errors result from poor
program design; where the program will successfully compile but still tends to run
improperly. A good example is poor error control and detection. For instance,
suppose I created a program to calculate an employee's monthly paycheck, by
deducting certain taxes from inputting hours and wages. So, let’s say I accidently
inputted for "hours worked" -30 or 1825 hours. Clearly, these inputs are both
impractical, so they will potentially have a problem with some of the other
calculations that will be made once the user enters that information into the
program. The best way to prevent these errors is to slow down and think out your
program thoroughly. Asking a lot of "what ifs" is a great thing to do with every
step in the logic control process. What if I typed in "A" or "dog" for my hours.
Most likely entries like this would not happen but another aspect of other than just
an appropriate range of numbers to be mindful of.

More Related Content

PPTX
Coding standards
DOCX
Basic email tips
PPT
Email etiquette 131220225255-phpapp02 -
DOCX
Errors in Computing- Runtime, Semantics, Syntax and Fixed and Floating point
PPTX
3 Embarrassing Subject Line Mistakes to Avoid
PPTX
2.1.8 clean code and debugging
PDF
Advance sas useful tricks
PPSX
Understanding Simple Program Logic
Coding standards
Basic email tips
Email etiquette 131220225255-phpapp02 -
Errors in Computing- Runtime, Semantics, Syntax and Fixed and Floating point
3 Embarrassing Subject Line Mistakes to Avoid
2.1.8 clean code and debugging
Advance sas useful tricks
Understanding Simple Program Logic

What's hot (10)

PDF
How to Build Fit-for-Purpose Excel Models
PPTX
SAP OSS note search
PPTX
Module 03 communication on internet
PPTX
3 Embarrassing Subject Line Mistakes to Avoid
PPTX
Lindquist and willard tips and tools for electronic feedback
PDF
ML Interview Questions for Product-based companies
DOCX
PPTX
DOCX
Email etiquette[1]
PDF
If the coding bug is banal, it doesn't meant it's not crucial
How to Build Fit-for-Purpose Excel Models
SAP OSS note search
Module 03 communication on internet
3 Embarrassing Subject Line Mistakes to Avoid
Lindquist and willard tips and tools for electronic feedback
ML Interview Questions for Product-based companies
Email etiquette[1]
If the coding bug is banal, it doesn't meant it's not crucial
Ad

Viewers also liked (13)

PDF
Resultados de la encuesta realizada para evaluar cómo realizamos la evaluación
PDF
HP's Job Search Tips
PDF
DOCX
Como subir una presentacion a wikimedia
DOCX
Kartu legislatif
DOC
母親的借據
PDF
shaikh aleem ahmed
PDF
Ficha susi cala
DOC
大蒜殺菌功能強大腸胃病不用愁
DOCX
Costumbres indígenas ecuatorianas
DOCX
Pre cana
TXT
Read this
Resultados de la encuesta realizada para evaluar cómo realizamos la evaluación
HP's Job Search Tips
Como subir una presentacion a wikimedia
Kartu legislatif
母親的借據
shaikh aleem ahmed
Ficha susi cala
大蒜殺菌功能強大腸胃病不用愁
Costumbres indígenas ecuatorianas
Pre cana
Read this
Ad

Similar to Week2 dq2 (20)

PDF
Easy & Step-By-Step Ways of Finding Bugs in Software.pdf
PDF
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
PPTX
EDD (Error Driven Development)
DOC
Error Handling in Compiler Design.doctyp
DOC
Error Handling in Compiler Design.What a
DOC
Error Handling in Compiler Design.typeso
PPT
Error Correction Techniques
PDF
The D language comes to help
PDF
java programm for beginners (basic) level
PPTX
grade 10 2023.pptx
PDF
Introduction to Computer Programming
DOCX
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
PPT
Static white box testing lecture 12
PPT
White box testing
PPT
S D D Program Development Tools
PDF
Top 5 performance problems in .net applications application performance mon...
PPTX
Final requirement for programming-Bonifacio, Mary Clemence
PPTX
Algorithmics, intro to data structures.pptx
PDF
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
PPTX
Switch case looping
Easy & Step-By-Step Ways of Finding Bugs in Software.pdf
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
EDD (Error Driven Development)
Error Handling in Compiler Design.doctyp
Error Handling in Compiler Design.What a
Error Handling in Compiler Design.typeso
Error Correction Techniques
The D language comes to help
java programm for beginners (basic) level
grade 10 2023.pptx
Introduction to Computer Programming
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
Static white box testing lecture 12
White box testing
S D D Program Development Tools
Top 5 performance problems in .net applications application performance mon...
Final requirement for programming-Bonifacio, Mary Clemence
Algorithmics, intro to data structures.pptx
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
Switch case looping

More from amaxwell2012 (9)

DOC
Week3 dq4
DOC
Week3 dq1
DOC
Week2 dq4
DOC
Week2 dq3
DOC
Week1 dq5
DOC
Week1 dq3
DOC
Week1 dq2
DOC
Week 4 dq 4
DOC
Week 4 dq 3
Week3 dq4
Week3 dq1
Week2 dq4
Week2 dq3
Week1 dq5
Week1 dq3
Week1 dq2
Week 4 dq 4
Week 4 dq 3

Week2 dq2

  • 1. I believe the three types of errors you can run into with a Java program consist of: 1. Syntax Errors 2. Semantic Errors 3. Logic and Runtime Errors A syntax error is an error that violates the coding rules for the Java language (or any language for that matter). I believe the most common syntax error, and speaking from personal experience, is forgetting the end bracket to a statement. Other common syntax errors include forgetting a semicolon. Forgetting a semicolon at the end of a statement could potentially cause multiple errors. The best place to start correcting these errors is with the first one detected in the list, as it will probably clear other errors out. A great way to combat this problem is to have a methodology in how you write your code. One habit I've gotten into, is after I type out a starting bracket for a statement or method, I immediately hit enter a few times then put the end bracket in. Once I do that I will move my cursor back up between the brackets and start typing out the logic of that statement. A semantic error in simple terms changes the meaning of the code to the compiler, confusing it. I think the most ubiquitous source of these errors (for me) is inadvertently messing up the names of variables. I tend to follow a specific naming schema, so all my variables are usually upper-case first word, upperclass second word, etc. For instance, SalesTax, or EmployeeFirstName, would be my variables. With that said, I have ran into error issues because I might type a variable incorrectly like salesTax and it produces an error. I believe only way to prevent errors (if possible) is to follow a strict naming rubric and maintain attention to detail as you pound out your code. The last error is a logic and/or runtime error. These errors result from poor program design; where the program will successfully compile but still tends to run improperly. A good example is poor error control and detection. For instance, suppose I created a program to calculate an employee's monthly paycheck, by deducting certain taxes from inputting hours and wages. So, let’s say I accidently inputted for "hours worked" -30 or 1825 hours. Clearly, these inputs are both impractical, so they will potentially have a problem with some of the other calculations that will be made once the user enters that information into the program. The best way to prevent these errors is to slow down and think out your program thoroughly. Asking a lot of "what ifs" is a great thing to do with every step in the logic control process. What if I typed in "A" or "dog" for my hours. Most likely entries like this would not happen but another aspect of other than just an appropriate range of numbers to be mindful of.