Académique Documents
Professionnel Documents
Culture Documents
Copyright Guideline
2013 Infosys Limited, Bangalore, India. All Rights Reserved.
Infosys believes the information in this document is accurate as of its publication date; such
information is subject to change without notice. Infosys acknowledges the proprietary rights of
other companies to the trademarks, product names and such other intellectual property rights
mentioned in this document. Except as expressly permitted, neither this documentation nor
any part of it may be reproduced, stored in a retrieval system, or transmitted in any form or by
any means, electronic, mechanical, printing, photocopying, recording or otherwise, without the
prior permission of Infosys Limited and/ or any named intellectual property rights holders
under this document.
Confidential
Confidential Information
This Document is confidential to Infosys Limited. This document contains information and data that
Infosys considers confidential and proprietary (Confidential Information).
Confidential Information includes, but is not limited to, the following:
Corporate and Infrastructure information about Infosys
Infosys project management and quality processes
Project experiences provided included as illustrative case studies
Any disclosure of Confidential Information to, or use of it by a third party, will be damaging to Infosys.
Ownership of all Infosys Confidential Information, no matter in what media it resides, remains with
Infosys.
Confidential information in this document shall not be disclosed, duplicated or used in whole or in part
for any purpose other than reading without specific written permission of an authorized representative of
Infosys.
This document also contains third party confidential and proprietary information. Such third party
information has been included by Infosys after receiving due written permissions and authorizations from
the party/ies. Such third party confidential and proprietary information shall not be disclosed, duplicated
or used in whole or in part for any purpose other than reading without specific written permission of
an authorized representative of Infosys.
3
Copyright 2013-2014,
Infosys Limited
Confidential
Course Information
Confidential
Recap
Topics covered on OO Fundamentals
SDLC Overview
OO Concepts
Introduction to UML
OO Fundamentals Implementation in Java
Instance Variables
Methods
Access Specifiers
Classes & Objects
Coding Standards
Confidential
OO Fundamentals
Implementation in Java
Confidential
Java Architecture (1 of 2)
Java Architecture is composed of the following components:
JavaProgramming
Language
JavaByteCode
JavaVirtual
Machine
ObjectOrientation
Programmerfriendly
features
Robust
Platformindependent
Intermediatecode
generatedbytheJava
compiler
AlsocalledJavaclass
file
FacilitatesWriteOnce,
RunAnywhere
Confidential
Loadsbytecodeand
executesthem
Itisplatform
dependent
Differentfordifferent
platforms
Java Architecture (2 of 2)
Confidential
10
Interacts with
Resides in
secondary memory
On execution
On execution
Program
ByteCode
Loaded to main
memory (process)
Output
ByteCode
On compilation
Resides in
secondary memory
Confidential
Generated on
output devices
11
CodeSegment
ExecutableCode
Datasegment
Globalvariables
Heap
DynamicMemory
Stack
LocalVariables
Note: Data segment and Global variables are not within the scope of the course
Confidential
12
Destroyed when the method in which they are declared completes execution (i.e
when it loses scope)
Confidential
13
Stored in the heap memory along with the object to which they belong
Confidential
14
Garbage Collection
Dynamically allocated memory that is no longer needed should be de-allocated
In Java, de-allocation is done by a Garbage Collector
It is a system-level thread to keep track of memory allocations
Functions of Garbage Collector:
Confidential
16
Confidential
Recursive Methods
18
Recursive method
A method invoking itself is referred to as Recursion
Typically, when a program employs recursion the function invokes itself with a
smaller argument
Computing factorial(5) involves computing factorial(4), computing factorial(4) involves
computing factorial(3) and so on
Confidential
19
Transferthe3disksfromtowerAtotowerB
Copyright 2013-2014, Infosys Limited
Confidential
20
Confidential
this reference
22
this reference
Demo: OO Fundamentals - Assignment 30
Implicit reference to refer the current object, i.e the object which invoked the
method
Used to resolve ambiguity between instance variables and local variables when
they have the same name, i.e it prevents instance variable hiding
this reference can be used in some cases to improve the readability of a
program
Confidential
Data Structures
24
Confidential
25
Data Structure
Many problems require more complex data types which involve a collection
of primitive data elements (organized in specific arrangement)
Collection of primitive data elements are referred to as complex/non primitive
data types
Non primitive data types have logical representation and also physical
representation
Example: Declaration of an array of integers in a program is a logical
representation. This needs a corresponding representation in memory with
contiguous chunks of 4 bytes to hold all elements of the array. However, a
programmer normally does not need to focus on this memory representation
A programmer defining a non primitive data structure will also have to define
operations on them since the computer only defines operations on primitive
types
Example: When a programmer declares an array of integers, he should also define
the operations for array elements.
Confidential
26
Data Structure
Homogenous
Values of the same types of data are stored, as in an
array or list
Heterogeneous
DataStructures
Linear
Values are arranged in linear fashion and are accessed in
sequence. E.g. Arrays, linked lists, stacks and queues
Nonlinear
Values are not arranged in order but some hierarchical
structure E.g. Trees, graph etc.,
Copyright 2013-2014, Infosys Limited
Confidential
27
can be
are
Tree
Array
Linked List
may implement
Graph
Hash table
Stack
Queue
Guided Activity: Introduction to Data Structures Assignment 31 and 32
Copyright 2013-2014, Infosys Limited
Confidential
28
Arrays An Introduction
Collection of homogeneous elements stored in continuous memory locations
Accessed in sequential as well as random
Uses index (position of the element) to locate an element
Confidential
29
Confidential
30
Assignments in Arrays
Confidential
31
Linked List
Collection of homogeneous data elements, not necessarily stored in continuous
memory locations
Memory location is logically referred to as node
Node contains two parts:
data
link
node
Confidential
32
Confidential
33
Stack
Ordered collection of elements in which only one end used for insertion and for
deletion
Elements are removed from the stack in reverse order, in which they were
inserted into it. So, stack is called Last-In-First-Out (LIFO) List.
Stack is an abstract data structure that can be implemented using either array or
a linked list
Confidential
34
Stack Operations
Confidential
35
Queue
Ordered collection of elements in insertion is done using one end and deletion
using the other end
Elements are removed from the queue in the order of their arrival into the queue.
So, queue is called First-In-First-Out (FIFO) List.
Queue is an abstract data structure that can be implemented using either array
or a linked list
Confidential
36
Queue Operations
Confidential
Non Linear
Data Structures
38
Trees Introduction
Used to model certain types of real world scenarios
Directory structures, hierarchical classification or categories etc.,
Confidential
39
Confidential
40
Confidential
41
Confidential
42
Self study
Arrays:
https://www.udacity.com/wiki/cs046/Lesson_7.2_-_ArrayLists_and_Arrays
http://www.homeandlearn.co.uk/java/java_arrays.html
: Linked List:
http://www.cs.cmu.edu/~adamchik/15-121/lectures/Linked%20Lists/linked%20lists.html
Trees
http://www.bowdoin.edu/~ltoma/teaching/cs210/spring09/Slides/210-Trees.pdf
Graphs
http://en.wikipedia.org/wiki/Travelling_salesman_problem
Copyright 2013-2014, Infosys Limited
Confidential
Thank You
2013 Infosys Limited, Bangalore, India. All Rights Reserved. Infosys believes the information in this document is accurate as of its publication date; such information is subject to change
without notice. Infosys acknowledges the proprietary rights of other companies to the trademarks, product names and such other intellectual property rights mentioned in this document. Except
as expressly permitted, neither this documentation nor any part of it may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, printing,
photocopying, recording or otherwise, without the prior permission of Infosys Limited and/ or any named intellectual property rights holders under this document.