0
Why does it give me only first output?
package test_2; public class R5_4 { public static void main(String[] args) { int n = 1; int m = -1; if (n < -m) { System.out.print(n); } else { System.out.print(m); } } public static void main(String[] args) { double x = 0; double y = 1; if (Math.abs(x - y) < 1) { System.out.print(x); } else { System.out.print(y); } } ==================================================== can someone explain to me please?
5 Respostas
+ 1
Because main method is already defined above, you will get an error for redefining main method the second time.
What are you trying to do that you think of making 2 main methods anyway?
+ 1
Choose one of them, can't have two main method definiton in a class.
+ 1
Can you explain me what is it exactly that you are trying to do that you think you need to have two main methods? why can't you use conditionals instead?
0
How do I make it runs?
0
any other ways to run it in one file?