Java error compiling

Hello Everybody!! I have a so called "school homework" and I need help, please. Here is the code:(by the way, if something is wrong with the code tell me): import javax.swing.*;

class Complex{

private double rd, im;

public Complex(){

}

public Complex(double realdel,imagin鋜del){

rd=realdel;

im=imagin鋜del;

}

public void set(double realdel,imagin鋜del){

rd = realdel;

im = imagin鋜del;

}

public Complex add(Complex){

Complex temp = new Complex();

temp = (this.rd + rd) + (this.im + im)*i;

return temp;

}

public Complex sub(Complex){

Complex temp = new Complex();

temp = (this.rd - rd)+(this.im-im)*i;

return temp;

}

public Complex mult(Complex){

Complex temp = new Complex();

temp = (this.rd*rd-this.im*im)+(this.rd*im+this.im*rd)*i;

return temp;

}

public Complex div(Complex){

Complex temp = new Complex();

temp = (this.rd*rd+this.im*im)/(rd*rd+im*im)+(this.im*rd-this.rd*im)*i;

}

public Complex konj(Complex){

Complex temp = new Complex();

temp = temp*(-);

}

public String toString(){

String temp = " " + rd + "" + im;

return temp;

}

}

Command Results:

C:\Documents and Settings\uno\Mina dokument\Programmering C\2006-09-15\Complex.java:11: <identifier> expected

public Complex(double realdel,imagin鋜del){

^

C:\Documents and Settings\uno\Mina dokument\Programmering C\2006-09-15\Complex.java:55: ')' expected

^

2 errors

Tool completed with exit code 1

Thanks in advance.

[1680 byte] By [Matedoga] at [2007-10-3 5:41:22]
# 1

First thing is, when you post code, use the code tags. There's a code button right next to the Spell Check button when you enter text. Just highlight the code, then click on the code button.

> Command Results:

> C:\Documents and Settings\uno\Mina

> dokument\Programmering C\2006-09-15\Complex.java:11:

> <identifier> expected

> public Complex(double realdel,imagin鋜del){

> ^

> ammering C\2006-09-15\Complex.java:55: ')' expected

> ^

> 2 errors

>

> Tool completed with exit code 1

>

> Thanks in advance.

So, when you declare variables in Java, you can do something likedouble realdel, imaginardel;

But, when you are specifying method or constructor parameters, you need to specify the type of each parameter and a variable name for each parameter. So your method declarations (all of them, not just the one on line # 11) should look like this.public Complex(double realdel, double imagin鋜del){

You have to correct most of you method declarations because they do not specify both a type and a variable name.

One suggestion: Don't write a whole bunch of code, then try compiling it. Instead, write some pieces and compile. That way, you don't have a whole bunch of unrelated errors. It will be a lot easier.

atmguya at 2007-7-14 23:49:12 > top of Java-index,Developer Tools,Java Compiler...
# 2

public void Complex(double realdel, double imagin鋜del)

if you don't want it to return anything or

public double Complex(double realdel, double imagin鋜del)

to

return double etc.

C_Heeneya at 2007-7-14 23:49:12 > top of Java-index,Developer Tools,Java Compiler...
# 3

> public void Complex(double realdel, double

> imagin鋜del)

> if you don't want it to return anything or

> public double Complex(double realdel, double

> imagin鋜del)

to

> return double etc.

Except "public Complex...." is a constructor so no return value should be specified. I agree that for methods, a return value is needed.

atmguya at 2007-7-14 23:49:12 > top of Java-index,Developer Tools,Java Compiler...