Computer

# Operators

## Operators

Operators are the symbol that is used doing the calculation.

### Types of Operators Operators

### Precedence of Operators

Precedence determines the order in which operators are executed.
Associate DVD reminder order from left to right or right to left.
B– Bracket
O– Of (power)
D– Division
M– Multiplication
A– Addition
S– Subtraction

### Expressions

it is the combination of one or more operator and operant and returns a value, as a result, its types are:-

• Arithmetic Expressions
• Boolean Expressions

### Statements

A statement is the smallest executable unit which is always terminated with a semicolon.
It’s types are

#### Expression Statement

These are Java expressions. Example: + + a; b – – etc.

#### Assignment Statement

It is used to assign a value with a variable. Example: a=b+c, etc.

### Null Statement

Null means empty. It is written as a single colon. Example: ;

### Compound Statement

This statement written in the pair of {} is known as a compound statement.

### Math Class

This class contains many functions that help us in solving mathematical problems.

 Function Name Argument Return Type Syntax Type sqrt () double double Math.sqrt(9); = 3It returns the square root of the number. pow () two double values double Math.pow (x,y); = It returns the square root of a number. random () Nil double Math.random (); It returns any random value. max () two double value double Math.max (x,y); It returns the larger value. min () double value double Math.min(x,y); It returns the smaller value. abs () double value double Math.abs(num); It returns positive value of a number. rint () double value int Math.int(8.5); = 9. It returns the integer value. sin () double value double Math.sin(angle); It returns the sin value of the integer. ceil () double value double Math.ceil(num); It returns the next integer value. floor () double value double Math.floor(num); It returns the previous integer value. cos () double value double Math.cos (angle); It returns the cosine value of the angle. tan () double value double Math.tan (angle); It returns the tangent value of the angle. log () double value double Math.log(num); It returns the logarithmic value of a number. exp () double value double Math.exp(num); It returns the exponential value of the number.

### Errors in Java Program

Errors are small mistakes that affect the output of a program. It can be of three types-

#### Syntax Errors

These are the areas which are called file type in the code. example missing semicolon, missing braces, wrong spelling, etc.

#### Logical Errors

These errors are caused due to inappropriate logic.

#### Runtime Errors

These errors are caused during the runtime. example dividing a number by 0, lack of free memory space, opening a non-existing file.

### Data Type Conversion

It is the process of changing one type of data into another. In types are:

#### Implicit Type Conversion

In this data, types are automatically converted by the compiler.

#### Explicit Type Conversion

This conversion is forcefully done by the user.

### Getting Input from Keyboard

 Using Scanner Class Using Buffered Reader Header file Import java.util.Scanner; Import java.io* Opening lines Scanner sc = new Scanner (System.in) Buffered Reader br=(new Buffered Reader (new Input StreamReader)(System.in)) Input Statement To input a word- sc.next();   To input a sentence- sc.nextLine();   To input an integer – sc.nextInt();     To input a float number- sc.nextfloat();   To input a Double number – sc.nextDouble(); To input a word- br.readLine();   To input a sentence- br.readLine();   To input an Integer – Interger parse. Int/br readLine();   To input a float number- Float parse Float/br.readLine ();   To input a Double number – Double.parse Douuble (br. readLine());

### Related Articles Study Worms Would you like to receive notifications on latest updates? No Yes

## Adblock Detected

Please consider supporting us by disabling your ad blocker