Connecting Tech Pros Worldwide Help | Site Map

new to java

hjc hjc is offline
Newbie
 
Join Date: Oct 2006
Posts: 14
#1: Oct 22 '06
I am wondering how to write a java program that does the following:
There is one method required: get Max, which takes two integer variables as input in the command prompt, returns the bigger one of the two.
Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Oct 23 '06

re: new to java


Quote:

Originally Posted by hjc

I am wondering how to write a java program that does the following:
There is one method required: get Max, which takes two integer variables as input in the command prompt, returns the bigger one of the two.

You are certainly very new.

Expand|Select|Wrap|Line Numbers
  1. public int getMax(int a, int b) {
  2.    int max = 0;   
  3.    if(a > b) {
  4.       max = a;
  5.    }
  6.    else {
  7.       max = b;
  8.    }
  9.    return max;
  10. }
hjc hjc is offline
Newbie
 
Join Date: Oct 2006
Posts: 14
#3: Oct 23 '06

re: new to java


Thank you for your help, I find this very difficult to learn. Again thanks very much

Quote:

Originally Posted by r035198x

You are certainly very new.

Expand|Select|Wrap|Line Numbers
  1. public int getMax(int a, int b) {
  2.    int max = 0;   
  3.    if(a > b) {
  4.       max = a;
  5.    }
  6.    else {
  7.       max = b;
  8.    }
  9.    return max;
  10. }

Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#4: Oct 23 '06

re: new to java


Quote:

Originally Posted by hjc

Thank you for your help, I find this very difficult to learn. Again thanks very much

What do you find difficult to learn? The method I posted or java as a whole?
Reply