public class complex
{
int a;
int b;
int a1;
int b1;
class complex(int a,int b,int a1,int b1)
{
this.a=a;
this.b=b;
this.a1=a1;
this.b1=b1;
}
void sum()
{
System.out.println("First complex:"+a+b+"i");
System.out.println("Second complex:"+a1+b1+"i");
}
public static void main (String[] args)
{
complex fp=new complex(10,-5,-2,-4);
fp.sum();
}
}
D:\JAVA语言\java作业\complex.java:17: '{' expected
class complex(int a,int b,int a1,int b1)
^
D:\JAVA语言\java作业\complex.java:40: '}' expected
}
^
2 errors
处理已完成。