This is what Im gonna do:
In a class called UsefulMethods :
a) Write a method public static int maxOfTwo( int tal1, int tal2) {} . As you can see this method
will accept two integers as parameters and returns the larger of this two.
This one I rly need help with, here is where im stuckb) In another class called TestUsefulMethods, write a main program and test your maxOfTwo ().
To do it , first read two values from the user ( Sanner object required) and then call maxOfTwo
method with the two values. The programme shoul print the return from this method.
c) Go back to UsefulMethods class and write a new method. This method will also be static, and
the name should be evenlyDivisible. The method will accept two integers as parameters and
return true if the first parameter is evenly divisible by the second or vice versa and false if not.
d) Test your method by calling it in your programe TestUsefulMethods. Print the result from the

The first one I have done like this:

public class UsefulMethods
	public static int maxOfTwo(int tal1, int tal2)
		return tal1;
		return tal2;

So now my problem is to use this in:
This is what I have com up with atm.

import java.util.*;

public class TestUsefulMethods
	public static void main (String[] args)
	UsefulMethods m =new UsefulMethods();

	int tal1;
	int tal2;
	Scanner scan=new Scanner(System.in);
	System.out.println ("Highest number is: ");

Edited by qariella: n/a

8 Years
Discussion Span
Last Post by qariella
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.