import java.io.*;
import java.util.*;
class Q9 {
public static void main(String args[]) {
int a,b,c;
System.out.println("\n\t Enter the value of A,B & C ");
Scanner sc = new Scanner(System.in);
a = sc.nextInt();b = sc.nextInt(); c = sc.nextInt();
System.out.println("\nLargest = "+func(a,b,c));
}
public static int func(int a,int b,int c) {
if((a>=b)&&(a>=c)) {
return(a);
}
if((b>=a)&&(b>=c)) {
return(b);
}
if((c>=b)&&(c>=a)) {
return(c);
}
}
}
javauser1512
0
Newbie Poster
Recommended Answers
Jump to PostAlthough logically there should be a guarantee here that your function will reach a return statement, the java compiler doesn't seem to see it that way. I think there are two possible solutions:
1) Add an extra return statement that just returns some arbitrary value to appease the compiler.
2) …
All 4 Replies
Tumlee
42
Junior Poster in Training
jalpesh_007
-3
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
Starstreak
13
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.