II. Fill in the blanks.
1. A
is a blueprint of the attributes and the methods common to all
its objects.
2. An
has a unique identity with some characteristics and
behaviours.
3. A
is called a factory of objects.
4. The
is the core of Java.
5. A text written in Java has a file with the
extension.
6. The compiled program in Java has a file with the
extension.
Answers
Answer:
tell me Kya karna hai is question me....
I think ye in complete question h
Answer:
Question 1:
Object-oriented programming uses classes and objects. What are classes and what are objects? What is the relationship between classes and objects?
Answer:
When used in object-oriented programming, a class is a factory for creating objects. (We are talking here about the non-static part of the class.) An object is a collection of data and behaviors that represent some entity (real or abstract). A class defines the structure and behaviors of all entities of a given type. An object is one particular "instance" of that type of entity. For example, if Dog is a class, then a particular dog named Lassie would be an object of type Dog.
Question 2:
Explain carefully what null means in Java, and why this special value is necessary.
Answer:
When a variable is of object type (that is, declared with a class or interface as its type rather than one of Java's primitive types), the value stored in the variable is not an object. Objects exist in a part of memory called the heap, and the variable holds a pointer or reference to the object. Null is a special value that can be stored in a variable to indicate that it does not actually point to any object.
Question 3:
What is a constructor? What is the purpose of a constructor in a class?
Answer:
A constructor is a special kind of subroutine in a class. It has the same name as the name of the class, and it has no return type, not even void. A constructor is called with the new operator in order to create a new object. Its main purpose is to initialize the newly created object, but in fact, it can do anything that the programmer wants it to do.
Question 4:
Suppose that Kumquat is the name of a class and that fruit is a variable of type Kumquat. What is the meaning of the statement "fruit = new Kumquat();"? That is, what does the computer do when it executes this statement? (Try to give a complete answer. The computer does several things.)
Answer:
This statement creates a new object belonging to the class Kumquat, and it stores a reference to that object in the variable fruit. More specifically, when the computer executes this statement, it allocates memory to hold a new object of type Kumquat. It calls a constructor, which can initialize the instance variables of the object as well as perform other tasks. A reference to the new object is returned as the value of the expression "new Kumquat()". Finally, the assignment statement stores the reference in the variable, fruit. So, fruit can now be used to access the new object.
Question 5:
What is meant by the terms instance variable and instance method?
Answer:
Instance variables and instance methods are non-static variables and methods in a class; that is, their definitions in the class are not marked with the "static" modifier. This means that they do not belong to the class itself. Instead, they specify what variables and methods are in an object that belongs to that class. That is, the class contains the source code that defines instance variables and instance methods, but actual instance variables and instance methods are contained in objects, at least logically. (Such objects are called "instances" of the class.) Thus, instance variables and instance methods are the data and the behaviors of objects.
Hope it will help you kindly mark the answer as brainlist