Advertisements
Advertisements
Question
Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.
int fnMin(int n1, int n2)
{
return (n1>n2)? n1:n2);
}
Code Writing
Advertisements
Solution
class Minimum
{
int fnMin(int n1, int n2)
{
return(n1<n2) ? n1:n2;
}
}
shaalaa.com
Is there an error in this question or solution?
Chapter 3: User-Defined Methods - Exercises [Page 92]
