Java 2
Java 2
DEPARTMENT OF ECE
UNIT-I
OOP Concepts:-Data abstraction, encapsulation, inheritance, Benefits of Inheritance,
Polymorphism, classes and objects, Procedural and object oriented programming paradigms.
Java Programming- History of Java, comments, Data types, Variables, Constants, Scope and
Lifetime of variables, Operators, Operator Hierarchy, Expressions, Type conversion and casting,
Enumerated types, Control flow- block scope, conditional statements, loops, break and continue
statements, simple java stand alone programs, arrays, console input and output, formatting output,
constructors, methods, parameter passing, static fields and methods, access control, this reference,
overloading methods and constructors, recursion, garbage collection, building strings, exploring
string class.
UNIT – II
Inheritance – Inheritance hierarchies super and sub classes, Member access rules, super
keyword, preventing inheritance: final classes and methods, the Object class and itsmethods.
Polymorphism – dynamic binding, method overriding, abstract classes and methods.
Interfaces- Interfaces Vs Abstract classes, defining an interface, implement interfaces, accessing
implementations through interface references, extending interface.
Inner classes- Uses of inner classes, local inner classes, anonymous inner classes, static inner
classes, examples.
Packages- Defining, creating and accessing a package, Understanding CLASSPATH, importing
packages.
UNIT-III
Exception handling- Dealing with errors, benefits of exception handling, the classification of
exceptions- exception hierarchy, checked exceptions and unchecked exceptions, usage of try,
catch, throw, throws and finally, rethrowing exceptions, exception specification, built in
exceptions, creating own exception sub classes.
Multithreading – Differences between multiple processes and multiple threads, thread states,
creating threads, interrupting threads, thread priorities, synchronizing threads, inter-thread
communication, producer consumer pattern,Exploring java.net and java.text.
UNIT-IV
Applets – Concepts of Applets, differences between applets and applications, life cycle of an applet,
types of applets, creating applets, passing parameters to applets.
Event Handling: Events, Handling mouse and keyboard events, Adapter classes.
Files- Streams- Byte streams, Character streams, Text input/output.
Files- Streams- Byte streams, Character streams, Text input/output, Binary input/output, random
access file operations, File management using File class..
UNIT-V
GUI Programming with Java – AWT class hierarchy, component, container, panel, window, frame,
graphics.
AWT controls: Labels, button, text field, check box, and graphics.
Layout Manager – Layout manager types: border, grid and flow.
Swing – Introduction, limitations of AWT, Swing vs AWT.
TEXT BOOK:
1. Java Fundamentals – A Comprehensive Introduction, Herbert Schildt and Dale Skrien,
TMH.
REFERENCE BOOKS:
1. Java for Programmers, P.J.Deitel and H.M.Deitel, PEA (or) Java: How to Program ,
P.J.Deitel and H.M.Deitel,PHI
2. Object Oriented Programming through Java, P. Radha Krishna, UniversitiesPress.
3. Thinking in Java, Bruce Eckel,PE
4. Programming in Java, S. Malhotra and S. Choudhary, Oxford UniversitiesPress.
Course Outcomes:
An understanding of the principles and practice of object oriented analysis and design in
the construction of robust, maintainable programs which satisfy theirrequirements;
A competence to design, write, compile, test and execute straightforward programs using a
high levellanguage;
An appreciation of the principles of object orientedprogramming;
An awareness of the need for a professional approach to design and the importance of
good documentation to the finishedprograms.
Be able to implement, compile, test and run Java programs comprising more thanone
class, to address a particular softwareproblem.
Demonstrate the ability to use simple data structures like arrays in a Javaprogram.
Be able to make use of members of classes found in the Java API (such as the Mathclass).
MALLA REDDY COLLEGE OF ENGINEERING &TECHNOLOGY
DEPARTMENT OF ECE
INDEX
2 Benefits of Inheritance 2
I
Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is
a methodology or paradigm to design a program using classes and objects. It simplifies the
software development and maintenance by providing someconcepts:
o Object
o Class
o Inheritance
o Polymorphism
o Abstraction
o Encapsulation
Object
Any entity that has state and behavior is known as an object. For example: chair, pen, table,
keyboard, bike etc. It can be physical and logical.
Class
Inheritance
When one object acquires all the properties and behaviours of parent object i.e. known as
inheritance. It provides code reusability. It is used to achieve runtime polymorphism.
When one task is performed by different ways i.e. known as polymorphism. For example: to
convince the customer differently, to draw something e.g. shape or rectangle etc.
Another example can be to speak something e.g. cat speaks meaw, dog barks woof
etc.Abstraction
Hiding internal details and showing functionality is known as abstraction. For example: phone
call, we don't know the internal processing.
Encapsulation
Binding (or wrapping) code and data together into a single unit is known as encapsulation.
For example: capsule, it is wrapped with different medicines.
A java class is the example of encapsulation. Java bean is the fully encapsulated class because all
the data members are private here.
Benefits of Inheritance
One of the key benefits of inheritance is to minimize the amount of duplicate code in an
application by sharing common code amongst several subclasses. Where equivalent code
exists in two related classes, the hierarchy can usually be refactored to move the common
code up to a mutual superclass. This also tends to result in a better organization of code and
smaller, simpler compilationunits.
Inheritance can also make application code more flexible to change because classesthat
inherit from a common superclass can be used interchangeably. If the return type of a
method issuperclass
Reusability - facility to use public methods of base class without rewriting thesame.
Extensibility - extending the base class logic as per business logic of the derivedclass.