+ 3
What's wrong with my code
5 Answers
+ 4
//See this
public class Program
{
public int input(int x, int y, int z)
{
int small = 0;
if (x < y && x < z)
small = x;
else if ( y < x && y < z)
small = y;
else if ( z <x && z < y)
small = z;
return (small );
}
void show()
{
int small_no;
int m = 2, n = 3, o = 5;
small_no = input(m,n,o);
System.out.println("The smallest from "+m+","+n+" and "+o+" is "+small_no);
}
public static void main(String args[])
{
Program p=new Program();
p.show();
}
}
+ 3
Because u missing main function you need to write main function inside main function body u can call show function ()
+ 3
Oh thanks
But would it will be my silly mistake
+ 2
You have to define "main" function, and then call other functions (such as input() and show() ) in its body.
public static void main(String[] args) {
//call your functions here
}
Now you are not calling your functions.
0
https://www.sololearn.com/discuss/1538147/?ref=app
You should be first master the concept's of if else if and if statement.
Refer these for revision...
And check your Java course too
Hope it works...
Happy coding....
(*Joking answer)