16th Nov 2021, 9:39 AM
Ananya | Inactive |
Ananya | Inactive | - avatar
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(); } }
16th Nov 2021, 9:51 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
Because u missing main function you need to write main function inside main function body u can call show function ()
16th Nov 2021, 9:48 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
Oh thanks But would it will be my silly mistake
16th Nov 2021, 9:51 AM
Ananya | Inactive |
Ananya | Inactive | - avatar
+ 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.
16th Nov 2021, 9:49 AM
Morteza Hajji
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)
17th Nov 2021, 9:27 AM
š“š“·š“¼š“±š“²š““š“Ŗ (Anshika)
š“š“·š“¼š“±š“²š““š“Ŗ (Anshika) - avatar