answersLogoWhite

0


Best Answer

It is an abstract class so you can't instantiate it directly, but have to use a subclass instead.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why we can't create object for Container class using new keyword?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How constructor called?

You cannot invoke a constructor explicitly. It will get invoked implicitly when you call the new keyword on the class to create an object of the class. Ex: private ClassExample obj = new ClassExample(); here this new keyword usage on the ClassExample class will invoke the constructor of this class and create an object of that class.


What is object in java programming?

In java object is an instance of a class. Objects are created using the new keyword. When you use the new keyword along with a class name, an object of that class would get created. Ex: Ferrari obj = new Ferrari(); Here a new object of Ferrari gets created. A constructor of the class Ferrari would get invoked during the object creation.


What is meant by instancing a class?

The class can be considered a template to create objects. When you create an object, you create it on the basis of the specified class - the object is an instance of the class, and the act of creating the object is also known as "instantiating" the class.


Is super keyword is analogous to this keyword in java?

No. The keyword super is used to refer to the parent class instance while the keyword this is used to refer to the current class instance. You need to learn about Inheritance and Object creation using constructors to learn more about these keywords and their use


What does the java new operator do?

The new keyword tells Java that you want to create a new instance of a class by invoking one of the constructors for that class.// Create a new, empty String objectString s1 = new String();// Create a new String object with a different constructorString s2 = new String("howdy");

Related questions

What is a new keyword in java methods?

new is a keyword to create a instance of object any class.


How constructor called?

You cannot invoke a constructor explicitly. It will get invoked implicitly when you call the new keyword on the class to create an object of the class. Ex: private ClassExample obj = new ClassExample(); here this new keyword usage on the ClassExample class will invoke the constructor of this class and create an object of that class.


How do you create object of javabeen in servlet?

A JavaBean is nothing but a regular Java Class and hence it can be instantiated using the new keyword and invoking the bean constructor


Is it possible to create a Abstract class without abstract keyword?

no


What is object in java programming?

In java object is an instance of a class. Objects are created using the new keyword. When you use the new keyword along with a class name, an object of that class would get created. Ex: Ferrari obj = new Ferrari(); Here a new object of Ferrari gets created. A constructor of the class Ferrari would get invoked during the object creation.


What is meant by instancing a class?

The class can be considered a template to create objects. When you create an object, you create it on the basis of the specified class - the object is an instance of the class, and the act of creating the object is also known as "instantiating" the class.


Is super keyword is anologous to this keyword in java?

No. The keyword super is used to refer to the parent class instance while the keyword this is used to refer to the current class instance. You need to learn about Inheritance and Object creation using constructors to learn more about these keywords and their use


Is super keyword is analogous to this keyword in java?

No. The keyword super is used to refer to the parent class instance while the keyword this is used to refer to the current class instance. You need to learn about Inheritance and Object creation using constructors to learn more about these keywords and their use


What is the most commonly used container object?

A class.


What does the java new operator do?

The new keyword tells Java that you want to create a new instance of a class by invoking one of the constructors for that class.// Create a new, empty String objectString s1 = new String();// Create a new String object with a different constructorString s2 = new String("howdy");


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.


What is the use of static in public static void main?

The static keyword signifies that the method belongs to the class and not any of its objects. Hence, the JVM does not have to create an object of that class before beginning execution. Imagine how the JVM would create an object and invokes its method even before the class execution starts. That is why the main method is static and is the starting point of any java application.