answersLogoWhite

0


Best Answer

A container is a generic term for an object that can contain other objects. It is not a type of object you can construct, and so therefore it is abstract. Specific instances of containers (such as Windows, Frames, and Panels) all share similar functionality, and so they all inherit from the container class so as to reduce the amount of code that had to be written, and allow each container to accept other containers and components without having to code for each specific container and component directly.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

container class contains some abstract methods that are implemented in its subclasses that's why the container is an abstract

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why the container is an abstract class in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

When do you declare a method or class abstract in java?

when overriding of a class or a method is necessary, they can be declared as abstract


How do you achieve abstraction in java?

Abstraction in Java is achieved using interfaces and abstract class. abstract means something which is not complete or concrete but abstraction itself is a great programming concept and allow you to write code which is more flexible to change.


Abstract method with example in java?

An abstract in java is used to specify that the class/function is not yet complete. When a class in declared as abstract it means that it is not meant to be instantiated (you can't create variables of that type). This is because they are meant to be more of a guideline for other classes. When a class extends an abstract class it must either define all of the abstract methods from the abstract class or it must also be declared as an abstract class itself.


What are abstract classin java?

An Abstract class is a special kind of class that cannot be instantiated. It has one or more methods which are not implemented in the class. These methods are declared abstract and they do not contain any code inside them.Ex:abstract class Parent {public abstract String getSon();public abstract String getDaughter();........//More methods that contain specific behaviour/code in them}The above is an abstract class "Parent" that has a lot of functionality but it has declared two abstract methods which have no code inside them. Any class that has one or more abstract methods has to be abstract. This abstract class cannot be instantiated.i.e., the below piece of code will not work. The code will not even compile.Parent object = new Parent();Purpose of Abstract Classes:Abstract classes are generally used where you want an amount of behaviour to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behaviour itself.A Child Class extending the Abstract Class:public class Child extends Parent {public String getSon() {return "Sons Name";}public String getDaughter(){return "Daughters Name";}...... //Code specific to the Child class}


Is reader class is an abstract class?

For Java: Yes, Reader is an abstract class in package of java.io; For C#: No, Reader is NOT one of the defined library classes. Of course you create one.

Related questions

When do you declare a method or class abstract in java?

when overriding of a class or a method is necessary, they can be declared as abstract


Are all java stream class an abstract?

yes


What are the class loaders in Java?

A class loader is an object that is responsible for loading classes. The class ClassLoader is an abstract class.


How do you achieve abstraction in java?

Abstraction in Java is achieved using interfaces and abstract class. abstract means something which is not complete or concrete but abstraction itself is a great programming concept and allow you to write code which is more flexible to change.


Abstract method with example in java?

An abstract in java is used to specify that the class/function is not yet complete. When a class in declared as abstract it means that it is not meant to be instantiated (you can't create variables of that type). This is because they are meant to be more of a guideline for other classes. When a class extends an abstract class it must either define all of the abstract methods from the abstract class or it must also be declared as an abstract class itself.


What are abstract classin java?

An Abstract class is a special kind of class that cannot be instantiated. It has one or more methods which are not implemented in the class. These methods are declared abstract and they do not contain any code inside them.Ex:abstract class Parent {public abstract String getSon();public abstract String getDaughter();........//More methods that contain specific behaviour/code in them}The above is an abstract class "Parent" that has a lot of functionality but it has declared two abstract methods which have no code inside them. Any class that has one or more abstract methods has to be abstract. This abstract class cannot be instantiated.i.e., the below piece of code will not work. The code will not even compile.Parent object = new Parent();Purpose of Abstract Classes:Abstract classes are generally used where you want an amount of behaviour to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behaviour itself.A Child Class extending the Abstract Class:public class Child extends Parent {public String getSon() {return "Sons Name";}public String getDaughter(){return "Daughters Name";}...... //Code specific to the Child class}


Is reader class is an abstract class?

For Java: Yes, Reader is an abstract class in package of java.io; For C#: No, Reader is NOT one of the defined library classes. Of course you create one.


Subclasses of an abstract class that do not provide an implementation of an abtract method are also abstract?

Yes. Any class that does not provide implementation to all its methods as well as its parent class methods needs to be Abstract. The Java compiler would not successfully compile a class that does not do this.


What do mean by interface in java?

An interface in Java is like an abstract class, but there are no method bodies allowed in it and it has to be declared with the interface keyword. It is Java's way of getting around the Deadly Diamond of Death. Only abstract methods and constants are allowed in it.


What is abstraction method in java?

Abstraction in Java or Object oriented programming is a way to segregate implementation from interface and one of the five fundamentals along with Encapsulation, Inheritance, Polymorphism, Class and Object. Abstraction in Java is achieved by using interface and abstract class in Java.


What is non-instantiable class?

A non-instantiable class is the class whose object can be created but cannot be initialized. for example the interfaces and the abstract classes in java.


What is the major difference between an Interface and a Class?

An interface can only have abstract methods or constants in it. A class can have both that and everything else in Java.