constructor - How do you create a complex variable in java? -
i'm using eclipse , messing around complex numbers. not sure how this. know how integer , double not complex type. found said
complex c= new complex(1.0.3.0); // 1+3i
but doesnt quite work out. gives error says constructor undefined?
do have complex.class
file in same folder other code? grabbed complex
class here, created complex.class
file javac complex.java
, running following code (filenames example.java
, example.class
) not problem:
class example { public static void main(string [] args) { complex = new complex(1,2); } }
Comments
Post a Comment