To understand the concepts of object-oriented, event driven, and concurrent programming paradigms and develop skills in using these paradigms using Java. Review of OOP - Objects and classes in Java — defining classes — methods - access specifiers — static members — constructors — finalize method — Arrays — Strings - Packages — JavaDoc comments. Inheritance — class hierarchy — polymorphism — dynamic binding — final keyword — abstract classes — the Object class — Reflection — interfaces — object cloning — inner classes — proxies. Graphics programming — Frame — Components — working with 2D shapes — Using color, fonts, and images - Basics of event handling — event handlers — adapter classes — actions — mouse events — AWT event hierarchy — introduction to Swing — Model-View- Controller design pattern — buttons — layout management — Swing Components.
|Published (Last):||16 April 2015|
|PDF File Size:||8.25 Mb|
|ePub File Size:||7.87 Mb|
|Price:||Free* [*Free Regsitration Required]|
Explain OOP Principles. OOP is defined as object oriented programming. 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. These variables are called as instance variables.
Methods are declared inside the class immediate after the instance variables declaration. Creating an object is also referred as instantiating an object. Object in java are created using the new operator. 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 programming. Data Abstraction: Data abstraction increases the power of programming language by creating user defined data types. Data abstraction also represents the needed information in the program without presenting the details. Data Encapsulation: 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: Polymorphism allows routines to use variables of different types at different times. An operator or function can be given different meanings or functions. The ability of objects to respond differently to the same message or function call.
Message passing: 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. Constructor: 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 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: 1. System package. User defined package. Uses of Packages: 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. Using packages we can hide classes. We may like to use many of the classes Import packagename.
Access a package The import statement can be used to search a list of packages for a particular class. The general form of import statement for searching class is a as follows. Import package1 [.
What is Array?. 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 is 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. What is javaDoc? Explain the comments for classes, methods, fields and link. The Javadoc is written next to the items without any separating newline. This is 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 , is optional. If there were any, it would be here. 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 Field 6. Illustrate with examples: static and final. Static Methods The mean method would work just as well if it wasn't declared static, as long as it was called from within the 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 it 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 debugging 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. Eg: 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 final using the keyword final as a modifier.
Finalizer methods In java we know that 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 explicitly 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 class with the same name, same return type, same parameter. Explain the concept of inheritance and its types.
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 image 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 class because every car has the features of it's 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 known as simple inheritance. In case of simple inheritance there is only a sub class and it's parent class.
It is also called single inheritance or one level inheritance.
CS2305 Programming Paradigms Question Bank - 16 Mark Questions - Anna University CSE 5th Semester
Proposals for joint Research Programmes. DST has called for Proposals for joint Research Programmes with Australia, Czeck republic, Germany and Netherlands, as could be seen from the extracts of the announcement given below. The website addresses are also given below. Faculty members who are interested may submit proposals through CTDT. MPG will allocate up to 20, euro p. Groups established at IPI.