Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
RJ MANTRA ENGLISH SCHOOL
VIRUDHUNAGAR
Subject : Computer Applications
1. What is the significance of using the word ‘new’ while creating objects? ‘New’ is used for dynamic allocation of the Objects. i.e., it allots space in the dynamic memory for storage of an Object. ‘New’ keyword is used to initialize/ Create an Object in a Java Program Ex. Student stu=new Student(); Here new Keyword is used to create an object of the class Student. 2. Why an object is called an instance of a class? Class is the creator of the objects and by invoking the class as a data type its member. Eg. Object is formed. Thus, an Object is called as an instance of the class. (Or) An object has instant variables and member methods defined within the class. Hence, an Object is called an instance of a class. 3. Difference between Class and Objects Class Object 1. Class is a representation of an 1.Object is a real world unique entity abstraction only having some characteristics and behaviours 2. Class is an object producer and 2.Object is created with the use of hence called a blue print for a the ‘new’ keywords set of Objects 3. It is known as ‘Object Factory’ 3.It is known as an ‘Instance of a class’
4. Why a class is called an Object factory?
A class is a collection of objects A class is used to produce or create various objects containing common attributes and behaviour. Hence, class is called object factory 5. Why is a class known as composite data type? A composite data type is one which is composed with various primitive data types. A class can contain various primitive data types as its data members so it is known as a composite data type. 6. Why called class is a user defined data type? User –defined classes combine the data and methods as integrated components Similarly, a user may create a data type and declare certain charactertics and behaviour within it. This can be done by using a class. This is the reason why a class is referred as user defined data types. *******