Deprecated: Creation of dynamic property Kirki_Toolkit::$modules is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/kirki.php on line 67

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Textarea::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Toggle::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Custom::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Custom::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio_Image::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Multicheck::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Number::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Text::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio_Image::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Multicheck::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Checkbox::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Switch::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Radio_Image::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Custom::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Deprecated: Creation of dynamic property Kirki_Field_Custom::$label is deprecated in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php on line 291

Warning: Cannot modify header information - headers already sent by (output started at /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-content/themes/hitmag/inc/kirki/core/class-kirki-field.php:291) in /home/rh00k03md44z/public_html/new.octopuscodes.com/wp-includes/feed-rss2.php on line 8
Java Arithmetic Operators Archives - OctopusCodes https://octopuscodes.com/tag/java-arithmetic-operators/ Sun, 22 Jan 2023 13:09:07 +0000 en-US hourly 1 https://wordpress.org/?v=6.9 https://octopuscodes.com/wp-content/uploads/2022/12/cropped-logo-80x80-1-32x32.png Java Arithmetic Operators Archives - OctopusCodes https://octopuscodes.com/tag/java-arithmetic-operators/ 32 32 Arithmetic Operators in Java https://octopuscodes.com/java/java-tutorial/basic-java/arithmetic-operators-in-java/ Tue, 27 Dec 2022 07:14:32 +0000 https://octopuscodes.com/?p=641 The Java programming language supports various arithmetic operators for all floating-point and integer numbers. Operator Operation + Addition – Subtraction * Multiplication / Division % Modulo Operation (Remainder after division) …

The post Arithmetic Operators in Java appeared first on OctopusCodes.

]]>
The Java programming language supports various arithmetic operators for all floating-point and integer numbers.

OperatorOperation
+Addition
Subtraction
*Multiplication
/Division
%Modulo Operation (Remainder after division)

1. Addition(+)

This operator is a binary operator and is used to add two operands.

package octopuscodes.com.demo;

public class Demo {

	public static void main(String[] args) {
		int a = 10, b = 5;
		int sum1 = a + b;
		System.out.println("Sum 1: " + sum1);

		float number1 = 5.6f, number2 = 7.8f;
		float sum2 = number1 + number2;
		System.out.println("Sum 2: " + sum2);

		double number3 = 12.3, number4 = 4.31;
		double sum3 = number3 + number4;
		System.out.println("Sum 3: " + sum3);
	}

}
Sum 1: 15
Sum 2: 13.4
Sum 3: 16.61
 

2. Subtraction(-)

This operator is a binary operator and is used to subtract two.

package octopuscodes.com.demo;

public class Demo {

	public static void main(String[] args) {
		int a = 10, b = 5;
		int result1 = a - b;
		System.out.println("Result 1: " + result1);

		float number1 = 5.12f, number2 = 7.33f;
		float result2 = number1 - number2;
		System.out.println("Result 2: " + result2);

		double number3 = 12.35, number4 = 4.31;
		double result3 = number3 - number4;
		System.out.println("Result 3: " + result3);
	}

}
Result 1: 5
Result 2: -2.21
Result 3: 8.04
 

3. Multiplication(*)

This operator is a binary operator and is used to multiply two operands.

package octopuscodes.com.demo;

public class Demo {

	public static void main(String[] args) {
		int a = 10, b = 5;
		int result1 = a * b;
		System.out.println("Result 1: " + result1);

		float number1 = 5.12f, number2 = 7.33f;
		float result2 = number1 * number2;
		System.out.println("Result 2: " + result2);

		double number3 = 12.35, number4 = 4.31;
		double result3 = number3 * number4;
		System.out.println("Result 3: " + result3);
	}

}
Result 1: 50
Result 2: 37.5296
Result 3: 53.2285
 

4. Division(/)

This is a binary operator that is used to divide the first operand(dividend) by the second operand(divisor) and give the quotient as a result

package octopuscodes.com.demo;

public class Demo {

	public static void main(String[] args) {
		int a = 10, b = 5;
		int result1 = a / b;
		System.out.println("Result 1: " + result1);

		float number1 = 5.12f, number2 = 7.33f;
		float result2 = number1 / number2;
		System.out.println("Result 2: " + result2);

		double number3 = 12.35, number4 = 4.31;
		double result3 = number3 / number4;
		System.out.println("Result 3: " + result3);
	}

}
Result 1: 2
Result 2: 0.6984993
Result 3: 2.8372093023255816
 

5. Modulus(%)

This is a binary operator that is used to return the remainder when the first operand(dividend) is divided by the second operand(divisor). 

package octopuscodes.com.demo;

public class Demo {

	public static void main(String[] args) {
		int a = 10, b = 5;
		int result1 = a % b;
		System.out.println("Result 1: " + result1);

		int number1 = 10, number2 = 4;
		int result2 = number1 % number2;
		System.out.println("Result 2: " + result2);
	}

}
Result 1: 0
Result 2: 2

The post Arithmetic Operators in Java appeared first on OctopusCodes.

]]>