Computer Science, asked by bg100030, 3 months ago


Write a java program to take two integer arguments in a method void small() to print the
largest integer.​

Answers

Answered by kamalrajatjoshi94
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