The Artima Developer Community
Sponsored Link

Java Answers Forum
Write a method with the header

2 replies on 1 page. Most recent reply: Jun 11, 2003 2:18 AM by Adam Duffy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
janeceg

Posts: 2
Nickname: jgg
Registered: Jun, 2003

Write a method with the header Posted: Jun 10, 2003 6:48 AM
Reply to this message Reply
Advertisement
How can I write a method with the header: public static int minimum(int i, int j, int k) that runs the smallest of i, j, and k.


Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Write a method with the header Posted: Jun 10, 2003 10:44 PM
Reply to this message Reply
> How can I write a method with the header: public static
> int minimum(int i, int j, int k) that runs the smallest of
> i, j, and k.

public static int minimum(int i, int j, int k)
{
int min;

// Insert code that set min to the appropriate value.

return min;
}


Vince.

Adam Duffy

Posts: 168
Nickname: adamduffy
Registered: Feb, 2003

Re: Write a method with the header Posted: Jun 11, 2003 2:18 AM
Reply to this message Reply
How about this?

public static int minimum( int i, int j, int k )
{
  return( Math.min( i, Math.min( j, k ) ) );
}


Adam

Flat View: This topic has 2 replies on 1 page
Topic: Transparent GIF Previous Topic   Next Topic Topic: Get value at the top of the stack....

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use