Home > Back-end >  School work out all the prime Numbers within 100
School work out all the prime Numbers within 100

Time:09-26

School work has just started to learn Java
Project contents:
By a single file, many class
Create a master class, only contains the main () method
1, write a program to find the all the prime Numbers within 100
Requirements: to implement a class, including a return to prime method, and a passing parameters method of output of 100
Second request output methods don't understand is to point to what

CodePudding user response:

Method for parameter method and parameter method, if you are in the method, in 100 the number of fixed, can find out all the prime Numbers within 100, if you set this parameter method () on the inside of the head, a method is called when can pass the 100 number, 99103200, for example, can work out them after all the prime Numbers

CodePudding user response:

I understand that you should is to bring about A class that contains two methods A method return types Boolean, Integer parameters, used to judge whether A number is prime, B method returns void, parametric Integer maxNum, by calling A method to judge and print all prime Numbers between 0 and maxNum, then the main () method calls B (100) to perform
  • Related