Wednesday, 1 April 2015

Exercise-9 : Write a Java Program to Count the Number of Vowels in a given string. Use Constructor, Instances and Method, if necessary. Do not use any parameter with Constructor.

package inheritence;
class inher
{
int m, n;
void display1()
{
System.out.println("Value of m n =" +m +" " +n);
}
}

class hasmot extends inher
{
int p;
void display2()
{
System.out.println("Valu of p =" + p);
}
void sum()
{
System.out.println("Sum of m n p =" +(m+n+p));
}
}
public class Inheritence {



public static void main(String[] args)
{
inher input=new inher();
hasmot input1=new hasmot();
input.m=40;
input.n=60;
System.out.println();
input1.m=20;
input1.n=30;
input1.p=50;
System.out.println("Value of mnp");
input.display1();
input1.display2();
System.out.println();
System.out.println("The result is=");
input1.sum();

}

No comments:

Post a Comment