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 |
Diff.b/w Frames and container?
1 Answers Tech Mahindra, Wipro,
___ method used to move a recordset pointer in nth position in DAG.
What is the best action a system can take when deadlock is detected
is it acceptable if we declare multiple exceptions in same overridden method.
what is the difference between an OS(operating system) and Framework?
Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller cubes on the surface. Extend this to k-dimension.
details description on this mantis? who is founder of this mantis?
hii I inntrested abt scjp certification but i dont knw abt scjp plz send details abt scjp exam and syllabus.
What is a dialog based program
What r the attributes using in Win Runner?
0 Answers Tavant Technologies,
Find out the list of roles which gives access to GUI activities? thanks in advance
write a sql qwery which include joining of two tables 4 marks mainframe