Hello.
The benefits of using presentations to organize and deliver information are: it keeps things in order, keeps peoples attention longer, and it looks more professional.
Answer:
public class Digits
{
public static boolean allDigitsOdd(int num)
{
boolean flag=true;
int rem;
while(num>0)
{
rem=num%10;
num=num/10;
if(rem%2==0) // if a even digit found immediately breaks out of loop
{
flag=false;
break;
}
}
return flag; //returns result
}
public static void main(String args[])
{
System.out.println(allDigitsOdd(1375)); //returns true as all are odd digits
}
}
OUTPUT :
true
Explanation:
Above program has 2 static methods inside a class Digits. Logic behind above function is that a number is divided by 10 until it is less than 0. Each time its remainder by 0 is checked if even immediately breaks out of the loop.
Answer:
thanks my dude I needed it
Answer:
C. sqrt(Math)
Explanation:
All but one of options A to E are is not a static method.
Only option C is a static method. The sqrt() is a static method of Math, that can always be used as Math.sqrt() is used;
The Math class defines all of its methods to be static. Invoking Math methods is done by using Math as a method rather than a variable of type Math; this means that sqrt(Math) doesn't rely on instance variables and don't need to be overridden, unlike others.
Lastly, sqrt(Math) is a static method because unlike other options, it is an utility method, and it is relevant to computations on primitive data types.
The purpose of the static method is in large part to offer a standard library of functions, and it doesn't need to be applied directly to an object.