answersLogoWhite

0


Best Answer

Abstract Classes contain the work abstract in it. It is used when you know that you will need to use an object of its type but do not know the inner workings yet. Anonymous classes are those classes that are constructed on the fly. You need to know its inner workings.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Compare anonymous class with abstract class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

What is an abstract class Write the syntax Declare a pure virtual function in an abstract class?

an abstract class is nothing but class which contains both abstract and concrete methods for abstract class we r nt create object Syntax for pure abstract class is abstract class x { public void abstract y(); public void abstract z(); public void abc() { }


What is the difference between abstract class and normal class?

Any class which has one or more abstract methods is called an abstract class. But in the normal class we can't have any abstract methods. We cannot create an object for the abstract classes. When we inherit the abstract class we should implement the abstract method which we inherit.


What is the abstract of compare?

The abstract noun forms of the verb to compare are comparison and the gerund, comparing.


What is an anonymous class in oops?

class is defined in the class


How do you call an abstract class from main method?

An abstract class cannot have a constructor and hence you cannot invoke the constructor of the class - i.e., you can instantiate an abstract class and hence you cannot call the constructor of an abstract class.


True or false All methods in an abstract class must be abstract?

False. In fact, it is possible to have no abstract methods in an abstract class.


What happens if an abstract modifier is applied to class. Explain?

The classes which have one or more abstract methods are abstract. To declare a class as abstract, use the abstract keyword in front of the class keyword, before the class declaration. Abstract classes cannot be instantiated. Similarly the new keyword cannot be used to create an object of the abstract class. Remember that the constructors and static variables cannot be declared as abstract. Any subclass of an abstract class must either implement all of the abstract methods in the superclass or be itself declared abstract.


Can abstract class have constructors?

A constructor of a class in invoked when a object of that class is created. As an abstract class can't have an object, so we can't create a constructor of the abstract class. But we can create a constructor of a concrete subclass of that abstract class and we have to pass the object of that concrete subclass to the abstract class.


What is an anonymous class?

An anonymous class is a local class without a name. An anonymous class is defined and instantiated in a single succinct expression using the new operator. While a local class definition is a statement in a block of Java code, an anonymous class definition is an expression, which means that it can be included as part of a larger expression, such as a method call. When a local class is used only once, consider using anonymous class syntax, which places the definition and use of the class in exactly the same place.New Syntax for Anonymous ClassesWe've already seen examples of the syntax for defining and instantiating an anonymous class. We can express that syntax more formally as: new class-name ( [ argument-list ] ) { class-body }or: new interface-name () { class-body }


What is abstract base class?

An abstract class is a class that cannot be directly instantiated. The purpose of such a class is to put some logic in a base class and force derived classes to implement the remaining functionality. Since the full functionality is only available in the derived class, the base class is declared as abstract so that it cannot be instantiated directly.


What is the abstract noun of compare?

The abstract nouns for the verb to compare are comparison and the gerund, comparing.


What is true about true about abstract data type Object of an abstract class type cant be created. We can derive classes from these abstract classes Object of an abstract class t?

True - an instance of an abstract class cannot be created. False - derive (subclass) from a class, not the object (the instance).