Discussion Forum Unit 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

The concept of the syntax rule is a programming language that considers what is and is not allowed

in a program. When a program has a syntax error, its output can't be compiled. It can also make the
commands unclear or unintelligible to the computer. For instance, if we're writing a program with a
line of code that doesn't include a semicolon, then we might have a syntax error.

The semantics error in a program is a type of programming language that considers whether or not a
statement is valid. It then reads the statement and validates it, and if it is, it will execute it. Although
a semantic error can be run and interpreted, it can also lead to an incorrect result. This is why it's
important to analyse the program in run-time whenever it has one.

The types of semantic errors that can occur are as a result of a mistake in the variable or an
operation in the wrong order. They can also be caused by an operator being wrong. Although we can
have a valid syntax, if an operator is not right, then the program will get an error.

Syntax example:

public class hello {

public static void main(String [] args) {

System.out.println("My name is : !)

Program will not run because is not properly closed by a double-quote

Semantic example:

String Name = 20;

Type miss match: cannot convert from int to String

Reference(s)
Eck, D. J. (2019). Introduction to
programming using Java, version
8.1. Retrieved from:
http://math.hws.edu/javanotes.
Reference(s)

Eck, D. J. (2019). Introduction to programming using Java, version 8.1. Retrieved from:
http://math.hws.edu/javanotes.

You might also like