## Java Program To Find Roots of a Quadratic Equation

Learn How To Find Roots of a Quadratic Equation in Java Programming Language. This Java Program To Compute Roots of Quadratic Equation makes use of **If – Else** Block.

#### What is a Quadratic Equation?

It is a term used in Elementary Algebra. The Standard Form of a Quadratic Equation is **ax ^{2} + bx + c = 0, **where

**a**,

**b**,

**c**are constant values which cannot be changed and

**x**is a variable entity.

#### Quadratic Equation Formula

**h = −b ± √(b ^{2 }− 4ac) / 2a**

#### Conditions For Discriminants

- If
**b**, One Real Solution is possible^{2 }− 4ac = 0 - If
**b**is^{2 }− 4ac**Positive**, Two Real Solutions are possible - If
**b**is^{2 }− 4ac**Negative**, Two Complex Solutions are possible

The** java.lang.*** package consists of **Math.sqrt()** method which helps to calculate the Square Root of the Discriminant.

**Also Read: Java Program To Draw A Circle using Graphics**

#### Java Program To Find Roots of a Quadratic Equation

[crayon-5c0d93836350a673767100/]

**Also Read: Java Code To Convert Numbers To Words**

#### Output

If you have any compilation errors or doubts in this Program to Find Roots of a Quadratic Equation in Java Programming Language, let us know about in the Comment Section below.