new to java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hjc
    New Member
    • Oct 2006
    • 14

    #1

    new to java

    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.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    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.

    Code:
    public int getMax(int a, int b) {
       int max = 0;   
       if(a > b) {
          max = a;
       }
       else {
          max = b;
       }
       return max;
    }

    Comment

    • hjc
      New Member
      • Oct 2006
      • 14

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

      Originally posted by r035198x
      You are certainly very new.

      Code:
      public int getMax(int a, int b) {
         int max = 0;   
         if(a > b) {
            max = a;
         }
         else {
            max = b;
         }
         return max;
      }

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        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?

        Comment

        Working...