Define Abstract method & class with Example

Answers were Sorted based on User's Feedback



Define Abstract method & class with Example..

Answer / 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

Define Abstract method & class with Example..

Answer / micheal b

abstract means wrapping the data in sigle unit
class is a user define data type

Is This Answer Correct ?    2 Yes 2 No

Define Abstract method & class with Example..

Answer / ramyathillainathan

We can indicate that a method must always be redefined in a sub class , thus making overriding compulsory. This is done using the modifier keyword abstract in the method definition.
example;
abstract class Shape
{
------------
------------
Abstract void draw();
------------
---------------
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Programming Languages AllOther Interview Questions

which worker is involved in all the phases of SDLC?

1 Answers  


what is difference between kpo and it industry? that is in terms of work, package etc

0 Answers  


i am getting the error while compiling my cics program with including db2 dclgen member it is showing that ur dclgen member not including and all the host variables are undeclared

0 Answers   TCS,


what is the certificates in biztalk?

0 Answers  


< No Frames > tag is used for

0 Answers  






it is a language or tools?

0 Answers  


Write a program to find duplicate number from array in minimum time complexity.

0 Answers   Genpact,


what is different between kenerl mode and user mode?

1 Answers  


how sap is different from other software ?

0 Answers  


I'm new to ABAP. What is Module pool in SAP?

0 Answers   TCS,


what are stubs related to foxpro?

0 Answers  


My Qualification is MCA.My interview is on 5th may.They may ask q as------AS u r MCA...Why u r not tring anywhere else? What can be the ans?

0 Answers   State Bank Of India SBI,


Categories