return the bigger number between the two parameters.
if numbers are equal return anyone on them.
public class BiggerNum{ public static int compare(int a, int b) { if(a > b){ return a; }else if(a < b){ return b; }else return a; } }
- public class BiggerNum{
- public static int compare(int a, int b) {
return 0;- if(a > b){
- return a;
- }else if(a < b){
- return b;
- }else return a;
- }
- }
import org.junit.Test; import static org.junit.Assert.assertEquals; import org.junit.runners.JUnit4; // TODO: Replace examples and use TDD development by writing your own tests public class SolutionTest { @Test public void testSomething() { int a = 10; int b = 5; assertEquals(10, BiggerNum.compare(a, b)); } }
- import org.junit.Test;
- import static org.junit.Assert.assertEquals;
- import org.junit.runners.JUnit4;
- // TODO: Replace examples and use TDD development by writing your own tests
- public class SolutionTest {
- @Test
- public void testSomething() {
- int a = 10;
- int b = 5;
//assertEquals(10, BiggerNum.compare(a, b));- assertEquals(10, BiggerNum.compare(a, b));
- }
- }