Computer Science, asked by goswamiharsh373, 25 days ago

[15]
lass overloading a function display as follows:
lisplay(String str,int p) with one String argument and one integer argument.It displays all the
uppercase if 'p' is 1(one) otherwise, displays all the lowercase
characters.
splay (String str, char chr) with one String argument and one character argument. It displays
All the vowels if char is 'v' or 'V' otherwise, displays all the
alphabets excluding vowels
.​

Answers

Answered by krishnavyshakdev
0

Answer:

import java.util.*;

class Overload

{

void joystring(String s,char ch1,char ch2)

{

String str=s.replace(ch1,ch2);

System.out.println(str);

}

void joystring(String s)

{

int first=s.indexOf(' ');

System.out.println("First index :"+first);

int last=s.lastIndexOf(' ');

System.out.println("Last index :"+last);

}

void joystring(String s1,String s2)

{

String s3=" ";

String str=s1.concat(s3).concat(s2);

System.out.println(str);

}

public static void main(String args[])

{

Overload obj=new Overload();

obj.joystring("TECHNALAGY",'A','O');

obj.joystring("Cloud computing means Internet based computing");

obj.joystring("COMMOM WEALTH","GAMES");

}

}

Similar questions