Methods
- What is the process of defining more than one method in a class differentiated by method signature?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Function overloading is a process of defining more than one method in a class with same name differentiated by function signature i:e return type or parameters type and number.
- What is the return type of a method that does not returns any value?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Return type of an method must be made void if it is not returning any value.
- Which of these methods can be used to check whether the given value is a number or not?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
isNaN() methods returns true if num specified is not a number, otherwise it returns false.
- What is the output of this program?
public class Result
{
public static void main(String args[])
{
double num0 = 205;
double num1 = 2;
double num2 = Math.IEEEremainder(num0, num1);
System.out.print(num2);
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
IEEEremainder() returns the remainder of dividend / divisor. Here dividend is 205 and divisor is 2 therefore remainder is 1.0. It is similar to modulus – ‘%’ operator of C/C++ language.
- What is the output of this program?
public class Result
{
public static void main(String args[])
{
double num =3.14;
int p = (int) Math.toRadians(num);
System.out.print(p);
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
0