Define Abstract method & class with Example

Answer Posted / manoj kumar verma allahabad(ba

Abstract class shows kins of relationship.it is the impure
abstract.Abstract class can have method with body or
without. Abstract class can not be instantiated.e.g. Object
nahi ban sakta abstract class ka.

for example :-
abstract class Shape
{
abstract void area(); // No body compulsory to be
overriding
void show()
{
System.out.println("Shape is the show");
}
}
class circle extends Shape
{
void area()
{

}
void show()
{
System.out.println("Show the circle");
}
}
class Testabstract
{
public static void main(String ar[])
{
circle c1=new Shape(); // error object of
abstract class cannot be made
circle c2=new circle();
c2.area();
c1.show();
}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain polymorphism. Provide an example.

618


WHAT IS THE MEANING OF CONSTANT ...EXEEDS LENGTH LIMIT WHILE COPYING FROM PS FILE TO KSDS

1523


What is abstract Method i want the exact definition and is there any possibility to declare class as abstract without any abstract methods in that class?If it is possible then tell me why and how?

1475


will it allow to add same value in HashMap class.

1664


How does the type system works when there is interoperability between a COM and .Net, i mean what exactly happens there

1568






What ports must be open for DCOM over a firewall? What is the purpose of Port 135?

7186


In JCl , we have COND parameter.This holds comparison code and condition.It also has only and even parameters. ex: COND((4,GE),EVEN).what the comma mean here. is that 'and' or 'or'.

1820


Please describe an example where you used object orientation in one of your programs.

1494


Difference between views and index in sas programming

1028


Can i please VHDL code for D-Latch with clear input ?? (HINT: Set up a “Process” with appropriate sensitivity list to get the desired D-Latch with Clr working.) Inputs and Outputs: entity Lab4b is Port ( Clr, Clk, D : in STD_LOGIC; Q : out STD_LOGIC); end Lab4b;

994


How to change the color of a cell or a row in a datagrid on mouse hover using javascript/.net

1537


what is the filters in biztakk server? where it can use?

1657


what is apt_dump_score in datastage where it is useful

1502


what is class module in vb6? what it's use? with example..

1951


Give examples of macro quoting function?

1554