CS PROGRAMMING PARADIGMS Regulation Lecture Notes Anna University CS PROGRAMMING PARADIGMS Lecture notes PP Notes 5TH. Anna University Fifth semester Third Year lecture Notes for Programming Paradigms CS PP free pdf! The Third Year,Fifth semester Anna. 5th semester Notes. GKM College Notes: 1. Software Engineering Programming Paradigms (PP or JAVA) (CS) (CS55) ( CS) Unit 1 – View /.
|Published (Last):||13 October 2006|
|PDF File Size:||5.61 Mb|
|ePub File Size:||18.29 Mb|
|Price:||Free* [*Free Regsitration Required]|
OOP is defined as object oriented programming. A ib is defined by the user is data type with the template that helps in defining the properties. Once the class type has been defined we can create the variables of that type using declarations that are similar to the basic type declarations.
Programming Paradigms CS notes – Annauniversity lastest info
In java instances of the classes which are actual objects Eg: These variables are called as instance variables. Methods are declared inside the class immediate after the instance variables declaration. An object in java essentially a block of memory, which contains space to store all the instance variables. Creating an object is also referred as instantiating an object.
Object in java are created using the new operator. Prpgramming are similar to functions or procedures that are available in other programming languages. Inheritance is the process of forming a new class from an existing class or base praadigms. The base class is also known as parent class or super class, the new class that is formed is called derived class.
Derived class is also known as a child class or sub class. Inheritance helps in reducing the overall code size reusability of the program, which is an important concept in object-oriented c2s305.
Data abstraction increases the power of programming language by lecturre user defined data types. Data abstraction also represents the needed information in the program without presenting the details. Data encapsulation combines data and functions into a single unit called class. When using Data Encapsulation, data is not accessed directly; it is only accessible through the functions present inside the class.
Data encapsulation enables the important concept of data hiding possible. Polymorphism allows routines to use variables of different types at different times.
CS2305 Programming Paradigms Question Bank – 16 Mark Questions – Anna University CSE 5th Semester
An operator or function can be given different meanings or functions. The ability of objects ni respond differently to the same message or function call. A message passing system provides primitives for sending and receiving messages using objects. These primitives may by either synchronous or asynchronous or both. Explain Constructors with examples. Constructors are the method. It is used to give initial values to instance variables of the objects. It is automatically called at the time of object creation.
A constructor has the same name as the class. A class can have more than one constructor. A constructor can take zero ,one ,or more parameters.
A constructor has no return value. A constructor is always called with the new operator. Explain Packages in detail.
Packages are container for the classes. It is stored in a hierarichical manner.
If we want to use the packages in a class, we want to import it. The two types of packages are: Packages reduce the complexity of the software because a large number of classes can be grouped into a limited number of packages. We can create classes with same name in different packages. Jn packages we can hide classes. We may like to use many of the classes Import packagename.
Access paraidgms package The import statement can be used to search a progrmaming of packages for a particular class. The general form of import statement for searching class is a as follows. How to declare array? Discuss the methods under Array Class. Arrays An array is a data structure that stores a collection of values of the same type.
You access each individual value through an integer index. Array Name [index] Integer constant, variable, or expression For Instance we can define an array name salary to represent a set of salaries of a group of employees.
A particular value is indicated by writing a number called index in brackets after the array name. Types of arrays One dimensional arrays Two dimensional arrays One Dimensional arrays A list of items can be given one variable name using only one subscript and such a variable cd2305 called single- subscripted of one dimensional array.
The subscript can also start from 0. This process is known as initialization using the array subscripts as shown below. We can obtain the length of array a using a. Series of characters represents a string, and easiest way to represent the string is array Eg: Explain the comments for classes, paraddigms, fields and link.
The Javadoc is written next to the items without any separating newline. The class declaration usually contains: This c2305 followed by 2 a longer description that may span in multiple paragraphs.
In those the details can be explained in full. This section, marked in brackets lecure, is optional. If there were any, it would be here.
Here the variable contains only the short description: Class, Interface version version Provides version entry. Max one per Class, Interface Class or Interface. Field, Method Provides a link to other element of Class, Interface, documentation.
Field, Method Describes a method parameter. Method return description Describes the return value.
Method exception classname description Describes an exception that may be throws classname thrown from this method. Static Methods The mean method would work just as well if it wasn’t declared static, as long as it was called from within proggramming same class. If called from outside the class and it wasn’t declared static, it would have to be qualified uselessly with an object. Even when used within the class, there are good reasons to define a method as static when ntoes could be.
Anyone seeing that a method is static will know how to call it. Similarly, any programmer looking at the code will know that a static method can’t interact with instance variables, which makes reading and proggramming easier. A compiler will usually produce slightly more efficient code because no implicit object parameter has to be passed to the meth Calling static methods There are two cases.
Called from within the same class Just write the static method name. For instance methods, this is the object that the method will access. For static methods, the class name should be specified.
Static Members Let us assume that we want to define a member that is common to all the objects and can be accessed without using a particular object. That is the member belongs to the class as a whole rather than the objects created from the class. It can be defined as follows staticint count; Static int max int x, int y ; The members declared as static are known as static members. Static variable are used when we want to have a variable common to all instances of class.
Using static members Final methods and variables All method and variables can be overridden by default subclasses. If we wish to prevent the subclasses from overriding the members of the superclass, we can declare them as programminh using the keyword final as a modifier. Finalizer methods In java we know pparadigms Garbage collector will automatically free the memory resources used by objects. But objects may hold othernon-object resources such as file descriptor or window system fonts.
The Garbage collector cannot free those resources. The finalizer method is simply finalize and can be added to any class. Finalize method should nktes specify the operation to be performed 7. Explain method overriding with example program. A method is said to be overridden when one is in parent class and another is in child nofes with the same name, same return type, lectre parameter. Explain the concept of inheritance and its types.
CS Programming Paradigms Lecture Notes – All Units – SEC Edition
Inheritance The concept of inheritance is used to make the things from general to more specific e. When we hear the word vehicle then we got an image in our mind that it moves from one place to another place it is used for traveling or carrying goods but the word vehicle does not specify whether it is two or three or four wheeler because it is a general word. But the word car makes a more specific nores in mind than vehicle, that the car has four wheels.
It concludes from the example that car is a specific word and vehicle is the general word. If we think technically to this example then vehicle is the super class or base class or parent class and car is the subclass or child progdamming because every car has the features of leccture parent in this case vehicle class The following kinds of inheritance are there in java.
Simple Inheritance Multilevel Inheritance Simple Inheritance When a subclass is derived simply from it’s parent class then this mechanism is paraigms as simple inheritance. In case of simple inheritance there is only a sub class and it’s parent class.