Home > Back-end >  Excuse me why this error
Excuse me why this error

Time:09-25

The abstract class Number {
The abstract void method ();
}
The class Perfectextends Number {
Void method () {
System. The out. Println (" 2 to 1000 the number is as follows: ");
Inti, j, sum;
For (I=2; i <=1000; I++) {
Sum=0;
For (j=1; J & lt;=I/2; J++) {
If (I % j==0)
Sum=sum + j;
}
If (sum==I)
System. The out. Print (I + "");
}
System.out.println();
}
}
The class Prime extendsNumber {
Void method () {
System. The out. Println (" 2 to 100 prime number is as follows: ");
int i, j;
For (I=2; i <=100; I++) {
For (j=2; J & lt;=I/2; J++) {
If (I % j==0)
break;
}
If (j & gt; I/2)
System. The out. Print (I + "");
}
System.out.println();
}
}
Public class Test {
Public static void main (String [] args) {
Number n=new Perfect ();
N.m ethod ();
N=new Prime ();
N.m ethod ();
}
}

CodePudding user response:

This code, you think to hit people, all kinds of forget Spaces
  • Related