Computer Science, asked by sruthi7769, 1 month ago

Define a class to overload a function check() as follows

void check(int,int) - To check and print if the first int is divisible by

second or not,with an appropriate message

void check(char,char) - To check the numeric values of both the

characters and print the character with highest numeric values

Void check(String,char) - To check and print the number of times the

characters occurs in the string

Write a main method to call the above methods​

Answers

Answered by skmuffiskmuffi
1

Answer:

KnowledgeBoat Logo

Computer Applications

Design a class to overload a function compare( ) as follows:

void compare(int, int) — to compare two integers values and print the greater of the two integers.

void compare(char, char) — to compare the numeric value of two characters and print with the higher numeric value.

void compare(String, String) — to compare the length of the two strings and print the longer of the two.

Java

User Defined Methods

ICSE

12 Likes

ANSWER

import java.util.Scanner;

public class KboatCompare

{

public void compare(int a, int b) {

if (a > b) {

System.out.println(a);

}

else {

System.out.println(b);

}

}

public void compare(char a, char b) {

int x = (int)a;

int y = (int)b;

if (x > y) {

System.out.println(a);

}

else {

System.out.

Similar questions