public class ComplexNumber
extends java.lang.Number
| Modifier and Type | Field and Description |
|---|---|
private double |
imagPart
The imaginary part of this complex number.
|
private double |
realPart
The real part of this complex number.
|
private static long |
serialVersionUID
For serialization.
|
| Constructor and Description |
|---|
ComplexNumber(double real,
double imag)
Constructs a new complex number with the given real
and imaginary parts.
|
| Modifier and Type | Method and Description |
|---|---|
double |
doubleValue() |
float |
floatValue() |
double |
getImagPart()
Returns the imaginary part of this complex number.
|
double |
getRealPart()
Returns the real part of this complex number.
|
int |
intValue() |
long |
longValue() |
java.lang.String |
toString() |
private double realPart
private double imagPart
private static final long serialVersionUID
public ComplexNumber(double real,
double imag)
real - the real part.imag - the imaginary part.public double doubleValue()
doubleValue in class java.lang.Numberpublic float floatValue()
floatValue in class java.lang.Numberpublic int intValue()
intValue in class java.lang.Numberpublic long longValue()
longValue in class java.lang.Numberpublic double getRealPart()
public double getImagPart()
public java.lang.String toString()
toString in class java.lang.Object