class sample
{
void check( int a)
{
System .
out .
println ( "ODD OR EVEN NUMBERS" ) ; System .
out .
println ( "*************************" ) ; if ( a% 2== 0 )
System .
out .
println ( a
+ " is even" ) ; else
System .
out .
println ( a
+ " is odd" ) ;
}
void check( char c)
{
System .
out .
println ( "VOWEL OR NOT" ) ; System .
out .
println ( "****************" ) ; switch ( c)
{
case 'a' :
case 'A' : System .
out .
println ( c
+ " is vowel" ) ; break ;
case 'e' :
case 'E' : System .
out .
println ( c
+ " is vowel" ) ; break ;
case 'i' :
case 'I' : System .
out .
println ( c
+ " is vowel" ) ; break ;
case 'o' :
case 'O' : System .
out .
println ( c
+ " is vowel" ) ; break ;
case 'u' :
case 'U' : System .
out .
println ( c
+ " is vowel" ) ; break ;
default : System .
out .
println ( c
+ " is not vowel" ) ; }
}
void check( int a,int b)
{
int t;
System .
out .
println ( "\t \t SWAPPING" ) ; System .
out .
println ( "\t \t ********" ) ; System .
out .
println ( "Before swapping a and b value is:" + a
+ "\t " + b
) ; t= a;
a= b;
b= t;
System .
out .
println ( "After swapping a and b value is:" + a
+ "\t " + b
) ;
}
void check( int a,int b,int c)
{
System .
out .
println ( "\t \t BIGGIST AMONG THREE NUMBERS" ) ;
System .
out .
println ( "Numbers are:" ) ; System .
out .
println ( a
+ "\t " + b
+ "\t " + c
) ; if ( a> b&& a> c)
System .
out .
println ( a
+ " is grater" ) ; else if ( b> c)
System .
out .
println ( b
+ " is grater" ) ; else
System .
out .
println ( c
+ " is grater" ) ; }
}
class methodoverloading
{
public static void main
( String args
[ ] ) {
sample c1= new sample( ) ;
c1.check ( 22 ) ;
c1.check ( 'e' ) ;
c1.check ( 10 ,100 ,45 ) ;
c1.check ( 22 ,21 ) ;
}
}
Y2xhc3Mgc2FtcGxlCnsKdm9pZCBjaGVjayhpbnQgYSkKewpTeXN0ZW0ub3V0LnByaW50bG4oIk9ERCBPUiBFVkVOIE5VTUJFUlMiKTsKU3lzdGVtLm91dC5wcmludGxuKCIqKioqKioqKioqKioqKio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