Write a java program to take two integer arguments in a method void small() to print the
largest integer.
Answers
Answered by
0
Answer:
Program:-
import java.util.*;
public class Greatest
{
int a,b,max=0;
public void small()
{
Scanner in=new Scanner(System.in);
System.out.println("Enter the numbers");
a=in.nextInt();
b=in.nextInt();
max=Math.max(a,b);
}
public void print()
{
System.out.println("The greatest number="+max);
}
public static void main(String args[ ])
{
Greatest gt=new Greatest();
gt.small();
gt.print();
}
}
Similar questions
English,
1 month ago
Computer Science,
1 month ago
Science,
1 month ago
Math,
3 months ago
English,
10 months ago
Computer Science,
10 months ago