answersLogoWhite

0


Best Answer

There is no keyword for it. You can use a variable of 1 class in another only id the other class is derived from the 1st class.

Although you can use the variable of an object of a class in another class using object.variable

User Avatar

Wiki User

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

Wiki User

12y ago

The word class with all samll letters.

Ex: class MyClass

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which keyword is used to declare a class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

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

class MyClass extends AnotherClass {}


What is the keyword used to declare a class which cannot be instantiated?

abstract all lower case.


When do you declare a class as final?

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


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.


What does the keyword extends mean in BlueJ?

The "extends" keyword in Java is how you declare a subclass.class Base {void foo() {}}class Sub extends Base { //Sub is now a subclass of Basevoid begin(){Sub s = new Base(); //cannot do this the other way around!}}


Which is the keyword used to limit the scope of a function to the file in which it resides?

Declare the function static.


Which is the keyword used to limit the scope of the function to the file in which it is reside?

Declare the function static.


What if a final keyword is applied to a function?

The final keyword in JAVA means that the class can no longer be derived, i.e. it cannot be used as a base class for a new child class.If you declare a method as final, this method cannot be overridden in any of the child class that may extend this class.


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.


Why don't use abstract keyword when we declare a method in interface?

The abstract keyword signifies that the particular method will have no features in the class where it is declared and it is upto the child class to provide the functionality. In case of an interface, the method is already abstract by default and has no code inside it. So there is no actual point in using the abstract keyword there.


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