Topic- looping,function overloading,nesting ,polymorphism.
Aim - to write a function with a name buzz-buds,that will
check whether the given numbers are buddies or not on the
basis of no. of parameters passed during function calling.
Answer / Money Taygi
Here's an example in Java:nn```npublic class BuzzBuds {n public static void buzzBuds(int num1, int num2) {n System.out.printf("%d and %d are buddies.", num1, num2);n }nn public static void buzzBuds(int num) {n for (int i = 1; i <= num; i++) {n if (isPrime(i)) {n buzzBuds(i * i, i * i + 1);n }n }n }nn public static boolean isPrime(int num) {n if (num <= 1) return false;n for (int i = 2; i <= Math.sqrt(num); i++) {n if (num % i == 0) return false;n }n return true;n }n}n```
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between lambda expression and anonymous methods?
What's the difference between authentication and authorization? : java security
What is difference between loosely coupled and tightly coupled in java?
What is jdk jre and jvm?
What is stateless in java?
What is entitymanager in java?
What is the difference between jar and executable jar?
What is stateful in java?
What is java lang exceptionininitializererror?
What is savepoint in java?
What are the advantages of java 8’s date and time api over old date api and joda time api?
Is java an api?