Previous | Home | Next |
Answer: The difference between procedural and object-oriented programs are
- a) In procedural program, programming logic follows certain procedures and the instructions are executed one after another. In OOP program, unit of program is object, which is nothing but combination of data and code.
- b) In procedural program, data is exposed to the whole program whereas in OOPs program, it is accessible with in the object and which in turn assures the security of the code.
Answer:
- Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse.
- Inheritance is the process by which one object acquires the properties of another object.
- Polymorphism is the feature that allows one interface to be used more than one calss.In other world we can say polymorphism is a reusability of object in more than one class.
Answer: Assignment can be many times as desired whereas initialization can be only once.
Answer: Object oriented programming organizes a program around its data, i. e. , objects and a set of well defined interfaces to that data. An object-oriented program can be characterized as data controlling access to code.
Answer:
- class is a template for multiple objects with similar features and it is a blue print for objects. It defines a type of object according to the data the object can hold and the operations the object can perform.
- Constructor is a special kind of method that determines how an object is initialized when created. The name of constructor is same as class name.
- Primitive data types are 8 types and they are: byte, short, int, long, float, double, Boolean, char.
Answer: Object is an instance of a class and it is a software unit that combines a structured set of data with a set of operations for inspecting and manipulating that data. The object is created by using new keyword. When an object is created using new operator, memory is allocated to it.
Answer: Constructor will be automatically invoked when an object is created whereas method has to be called explicitly by using dot(.) operator .
Answer: Methods are functions that operate on instances of classes in which they are defined. By use of the method objects can communicate with each other and can call methods in other classes. Method definition has four parts. They are name of the method, type of object or primitive type the method returns, a list of parameters and the body of the method. A method’s signature is a combination of the first three parts mentioned above.
Answer: Bin contains all tools such as javac, appletviewer, awt tool, etc., whereas lib contains API and all packages.
Answer: Casting is process of convert the value of one type to another.
Answer: An argument can be passed in two ways. They are passing by value and passing by reference.
- Passing by value: This method copies the value of an argument into the formal parameter of the subroutine.
- Passing by reference: In this method, a reference to an argument (not the value of the argument) is passed to the parameter.
Answer: At time of defining method, variables passed in the method are called parameters At time of using those methods, values passed to those variables are called arguments.
Previous | Home | Next |