You are on page 1of 5

1.

Syntax of if else statement:


If condition returns true then the statements inside the body of “if” are executed and the statements
inside body of “else” are skipped.
If condition returns false then the statements inside the body of “if” are skipped and the statements
in “else” are executed.
2. All the program error in java

 Expected - This error occurs when something is missing from the code. Often this is created by a
missing semicolon or closing parenthesis.

 Unclosed String Literal - The “unclosed string literal” error message is created when the string
literal ends without quotation marks, and the message will appear on the same line as the error.
 Illegal Start of an Expression - There are numerous reasons why an “illegal start of an expression”
error occurs. It ends up being one of the less-helpful error messages. Some developers say it’s
caused by bad code.
 Cannot Find Symbol - This is a very common issue because all identifiers in Java need to be
declared before they are used. When the code is being compiled, the compiler does not
understand what the identifier means
 Public Class XXX Should Be in File - The “public class XXX should be in file” message occurs
when the class XXX and the Java program filename do not match. The code will only be compiled
when the class and Java file are the same.

3. Rational and logical operator

Relational Operators

Relational operators are used to compare two values in C language. It checks the relationship between two
values. If relation is true, it returns 1. However, if the relation is false, it returns 0.

Here is the table of relational operators in C language

Operators Operator Name


== Equal to

> Greater than

< Less than

!= Not equal to

>= Greater than or equal to

<= Less than or equal to

Logical Operators

Logical operators are used to perform logical operations. It returns 0 or 1 based on the result of condition,
whether its true or false. These operators are used for decision making in C language.

Here is the table of logical operators in C language,

Operators Meaning of Results


Operators

&& Logical AND True when all operands


are true

|| Logical OR True only if either one


operand is true
! Logical NOT True when operand is
zero
Source:

https://www.tutorialspoint.com/relational-and-logical-operators-in-c
https://dzone.com/articles/50-common-java-errors-and-how-to-avoid-them-part-1
https://beginnersbook.com/2014/01/c-if-else-statement-example/

You might also like