Define Abstract method & class with Example
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Hi..Am done with my Masters recently..Am planning to learn TIBCO.. could anyone suggest me about how the job market will be and Is there any course necessary to learn prior to Tibco..i mean any prerequisite. I dnt have any knowledge on PL/SQL thats it... Plz suggest me in a best way...
if 3 duplicate records, by keeping one original and one duplicate record, and how to delete remaining 2 duplicates in sql server 2008
SAS using companies in INDIA
29 Answers Bank Of America, Cap Gemini, Hyundai, IBM, KO, Sristek, TCS, Wipro, WNS,
Explain recursion with an example.
what is the similarity between networking devices?
Ordered List tag is
this question is from sas:what is the difference between FILE and INFILE statements? plz explain in brief?
how we can call xml file in java file using Android platform?
write algo for cobol program whichuse three flat file to extract some specific information 8 marks mainframe
why rownum=1 works properly but not rownum=>2,=>3 etc.
Difference between delegates and Events?
what is diff bet ref variable & instance of class