answersLogoWhite

0

An instance of a class is also known as an object. In the Java language, you use the new operator. Here is an example:

Integer x; // Using the wrapper class, Integer. This doesn't create the object yet.

x = new Integer(5); // This will create the instance.

These commands can be combined into one:

Integer x = new Integer(5);

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

How can you create a class which cannot be inheritable?

Declare it final.


When do you declare a method or class final?

if we declare a method as final then it can be changed.


How do you prevent extending a class in java?

You can declare a class as "final".


How do you prevent class extending in java?

Declare the class as final. final class A{ ... }


When will be the result of tenth class declare?

no one is sure about it thwt when it is going to declare


The Java keyword is used to declare a class as a subclass of another class?

class MyClass extends AnotherClass {}


What is the relationship between inheritance methods and the keyword final?

They are inversely related. That is: If you declare a method as final you cannot overridden in the child class If you declare a class as final you cannot inherit it in any other class.


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 many static function can declare in one class?

It is dependent on the requirement of your usage of the Object of that class


When do you declare a class as final?

By using the final keyword in the class declaration statement. Ex: public final class Test {...}


What happen if you declare class as recursive?

It will get a compiler error in Java.


How you declare class scoped variables and member functions?

To scope class members to the class (rather than to instances of the class), declare them as static members of the class. Static members are accessible even when no instances of the class exist. As such, static member functions do not have access to a 'this' pointer, unlike ordinary (nonstatic) member functions.