answersLogoWhite

0

What is instantiating in java?

Updated: 8/11/2023
User Avatar

Wiki User

15y ago

Best Answer

To instantiate is to create a new "instance" of an "object" in object-oriented programming. For example, say you create an Object by defining a class called Square: (note: this is C++ but the principles are the same)

class Square{

private:

int length, width;

public:

getArea(){return length*width);

};

The above class is an Object. When you create this object, that is called an "instance" of the object:

int main()

{

Square x = new Square; // x is an "instance" of the Square "object"

Square y = new Square; // y is a separate "instance" of the Square "object"

return 0;

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is instantiating in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Math class is an example of which class?

It is a static class; meaning that all the methods can be accessed directly from the class name, without instantiating an object.It is a static class; meaning that all the methods can be accessed directly from the class name, without instantiating an object.It is a static class; meaning that all the methods can be accessed directly from the class name, without instantiating an object.It is a static class; meaning that all the methods can be accessed directly from the class name, without instantiating an object.


Can you refer non static method from static content in java?

Shortly, you can not.Different approaches are however available.1. Put your non static method in different class. Then call it from your static content by first instantiating the class.2. Make a duplicate static method for your non static method and use from your static content.


Does Visual Java plus plus and Java Builder is different from the Java language?

Yes!Visual Java plus plus and Java Builder is different from the Java language?


What are the different java technologies?

There are several types of Java technology. Some examples of Java software are Java ME, Java EE, Java SE, and Java Card. Java made the JAVA development kit for those that develop in Java. There is also Java Virtual machine and some class libraries. Java is also famous for its languages like Clojure, Beanshell, Groovy, Gosu, Rhino, Kotlin, JRuby, Scala, and Jython.


Small Java-based programs are called?

Java applets

Related questions

What is classes instantiating?

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.


Math class is an example of which class?

It is a static class; meaning that all the methods can be accessed directly from the class name, without instantiating an object.It is a static class; meaning that all the methods can be accessed directly from the class name, without instantiating an object.It is a static class; meaning that all the methods can be accessed directly from the class name, without instantiating an object.It is a static class; meaning that all the methods can be accessed directly from the class name, without instantiating an object.


Can you refer non static method from static content in java?

Shortly, you can not.Different approaches are however available.1. Put your non static method in different class. Then call it from your static content by first instantiating the class.2. Make a duplicate static method for your non static method and use from your static content.


What Indonesian island is Jakarta on?

java


Does Visual Java plus plus and Java Builder is different from the Java language?

Yes!Visual Java plus plus and Java Builder is different from the Java language?


What are the different java technologies?

There are several types of Java technology. Some examples of Java software are Java ME, Java EE, Java SE, and Java Card. Java made the JAVA development kit for those that develop in Java. There is also Java Virtual machine and some class libraries. Java is also famous for its languages like Clojure, Beanshell, Groovy, Gosu, Rhino, Kotlin, JRuby, Scala, and Jython.


Small Java-based programs are called?

Java applets


Who create Java and when?

Who create Java & when? Why he create java ? What are mane functions of it?


What do you call java and javascript?

Well you get java as java and javascript as iava.


Supermost package of java?

The supermost package of Java is the "java" package.


Differences between Java Applet and Java Beans?

Java applet is a program used to run java applications while beans is a compiler used to design java programs (IDE, GUI) :-) GilbertC


When will you define a method as static in java?

Static keyword when used with a method, specifies that this method belongs to the class and not a particular instance of the class (a.k.a object of the class) Ex: public class StaticTest { public static String getAuthorName() { return "Anand"; } } Here getAuthorName is the static method and it can be accessed without instantiating an object of the class StaticTest. You can access this method as: String authorName = StaticTest.getAuthorName();