I am creating a class Perfect inside the main class and in Perfect class i am creating a method perf() and i want to call this method in the main method..how to do it?
My code is here
public class Fib {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
class Perfect {
void perf(){
int sum = 0;
int count = 0;
for(int i=6; i<=10000; i++){
for(int j=1; j<=i/2; j++){
if(i%j==0){
sum+=j;
}
}
if(sum==i){
count=count+1;
System.out.println(i);
}
sum=0;
}
System.out.println("Total perfect number is : "+count);
}
}
}