answersLogoWhite

0

for creating objects use the new operator along with a call to the constructor. for ex Triangle t = new Triangle(); In this statement the new operator creates a triangle object and the constructor is called which initializes the object and then new returns a reference of the object which is stored in the reference var "t" of type Triangle.

User Avatar

Wiki User

17y ago

What else can I help you with?

Related Questions

Can you initialize an object without constructor in java?

No. if you wish to create an object that you plan on using in a java program then the answer is NO. You cannot initialize an object of a Java class without calling the constructor.


What is classes in java?

class is a blueprint which does not have its own existence but it can pass all of its feature to its child classes.


What is the Object class parent?

Object is the topmost class in the Java Class hierarchy. There is no Class above Object. All classes in Java are implicitly derived from Object.


How oops concept is implemented in java?

OOP stands for Object Oriented Programming. Everything in Java is an Object. Any class you create extends the Object class by default thereby making everything in Java an object. Moreover, you can use features like Inheritance, Polymorphism, Encapsulation etc which are OOP concepts thereby making Java an Object Oriented Programming Language


What is a new keyword in java methods?

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


Is there class name as object in java?

Yes, the base class for all other Java classes is Object.


What is object class in java?

object class is a super class for all other class...


How is Java persistence done?

Java persistence is implemented using serialization. Serialization is a technique in java using which the contents of a java object (A class instance) can be written into a flat file. This value can be unserialized or deserialized at a later point of time to create the object. Any class that implements the Serializable interface can be serialized.


What is topleval class in java?

The top level class in Java is "Object." All other classes are subclasses of Object by default.


The top most class in java?

All classes in java must inherit from the Object class


Why object is the super class in java?

The answer to this is related to the idea of inheritance in general - the idea of inheritance is that you define a common set of behaviors, that apply to all subclasses. Anything defined in the "Object" class is available to all classes you create. Look in the documentation for the description of the "Object" class, to see what methods are available in all Java classes.


What is static java most commonly used for?

Static java method is the same as a static variable. They belong to a class and not an object of that class. If a method needs to be in a class, but not tied to an object, then one uses static java.