Revature Study Guide

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Access Modifiers w/ Method Overriding

The overridden method (i.e. declared in subclass) must not be more restrictive.

Generalization

The process of extracting shared characteristics from two or more classes, and combining them into a generalized superclass. Shared chars. can be attributes, associations, or methods.

Object

an instance of a class; it has state and behavior

Using

can be used with a namespace to give access to the classes inside of the namespace without having to use the fully qualified syntax

ArrayList methods

declare: ArrayList al = new ArrayList( ); .Add( ) .Capacity( ) .Count( ) traversing foreach ( int i in al ) { // code }

Constructor Overloading

defining multiple versions of a constructor for a single object, which are distinguished from each other by the type and number of parameters

Inheritance

A mechanism in which one object acquires all the properties and behaviors of a parent object. Advantages: - Method Overriding (runtime polymorphism) - Code reusability IS-A relationship

Abstract Method

A method declared as abstract and does not have implementation

default constructor

A no-argument constructor automatically provided by Java for classes that do not have any constructors; contains a default call to super( )

DCL

Data Control Language: GRANT and REVOKE

DDL

Data Definition Language CREATE, ALTER, DROP

DML

Data Manipulation Language SELECT, INSERT, UPDATE, DELETE

SDLC - System Analysis

Breaking down the system in different pieces to analyze the situation, project goals, and needs to be created...attempting to engage users so that definite requirements can be defined.

Difference between Virtual and Abstract Methods

- Abstract cannot have functionality, any child MUST give their own version of this method - Virtual has the functionality that may or may not be good enough for the child class.

CODE SCENARIO (abstraction)

- Create an abstract class called Bank - Abstract Method called getRateOfInterest() - Two subclasses called SBI - 7% PNM - 5% that extend Bank - Implement different functionalities for each subclass - print out each interest rate inside main() in a test class called TestBank

Advantages to Encapsulation

- You can make the class read-only or write-only - Provides you the control over the data. - Achieve data hiding - Easy to test so it is better for unit testing

How to Create a String Object

- by assigning a string literal to a string variable - by using a string class constructor - by using the string concatenation operator - by retrieving a property or calling a method that returns a string - by calling a formatting method to convert a value or an object to its string representation

4 OOP Pillars

Inheritance Polymorphism Encapsulation Abstraction

Hashtable Methods

.Add( key, value ) .ContainsValue( value ) ICollection key = ht.Keys foreach ( string k in key) { ht[ k ] }

Method Overriding Rules

1. Must have the same name as in the parent class 2. Must have the same parameter as in the parent class 3. Must be an IS-A relationship (inheritance)

Constructor Rules

1. constructor name must be the same as the class name 2. constructor must have no explicit return type 3. Java Constructor cannot be abstract, static, final, and synchronized

Method Overloading

A class has multiple methods having the same name but different in parameters (number of arguments and different types) Method overloading is not possible by changing the return type of the method.

Class

A class is a group of objects which have common properties. It is a template or blueprint from which objects are created.

Sub Class

A class which inherits the other class. (derived class, extended class, or child class)

Abstract Class

A class which is declared as abstract. - It can have abstract and non-abstract methods. - It needs to be extended and its method implemented. - It cannot be instantiated - It can have constructors and static methods also - It can have final methods which will force the subclass not to change the body of the method

Hashtable

A collection of key-and-value pairs that are organized based on the hash code of the key. It uses the key to access the elements in the collection Used when you need to access elements by using key, and you can identify a useful key value.

parameterized constructor

A constructor that accepts arguments. Used to provide different values to distinct objects.

Relational Database

A database that represents data as a collection of tables in which all data relationships are represented by common values in related tables

Abstraction

A process of hiding the implementation details and showing only functionality to the user. It shows only essential things to the user and hides the internal details. Lets you focus on what the object does instead of how it does it.

Encapsulation

A process of wrapping code and data together into a single unit. Created by making all the data members of the class private. We use setter and getter methods to set and get the data in it.

Constructor

A special type of method that is called when an instance of the object is created; it is used to initialize the object.

Interface

A syntactical contract that all the classes inheriting the interface should follow. The interface defines the 'what' and the deriving classes define the 'how'. Define properties, methods, and events which are the members of the interface. - contain only the declaration of the members

How to achieve abstraction?

An abstract class or an Interface

ArrayList

An ordered collection of an object that can be indexed individually. - can add and remove items from a list at a specified position using an index and the array resizes itself automatically - dynamic memory allocation - adding - searching - sorting

CODE SCENARIO

Bank is a class that provides functionality to get the rate of interest. However, the rate of interest varies according to banks. Bank: getRateOfInterest() SBI: 8% ICICI: 7% AXIS: 9%

SDLC - Investigation

Business opportunities and problems are identified, and information technology solutions are discussed. Multiple alternative projects may be suggested and their feasibility analyzed. Operational, economic, and technical feasibility are all analyzed.

Constructor vs Method

Constructor: - used to initialize the state of an object - must not have a return type - invoked implicitly - Java Compiler provides a default constructor if you do not provide one - constructor name must be the same as the class name Method: - used to expose the behavior of an object - must have a return type - invoked explicitly - not provided by the compiler in any case - method name may or may not be the same as class name

CODE SCENARIO (encapsulation)

Create an encapsulated class with 4 fields and the respective methods to access and edit those fields. Then go ahead and create a test class to verify. - Class Name: Student - Field Names: studentId, studentName, collegeName, address - Test Class Name : TestStudent

Specialization

Creating new subclasses from an existing class. If it turns out that certain attributes, associations, or methods only apply to some of the objects of the class, a subclass can be created.

Namespace

Designed for providing a way to keep one set of names separate from another. The class names declared in one do not conflict with same class names declared in another

OOPs vs Procedure Oriented Programming

Development and maintenance is easier with OOPs because it scales with the project OOPs provides data hiding

Abstract

Enables you to create classes and class members that are incomplete and must be implemented in a derived class

Sealed

Enables you to prevent the inheritance of a class or certain class members that were previously marked virtual.

Queue

First in First out collection of object .enqueue( ) .dequeue( ) ch = ( char )q.Dequeu( )

Stack

Last in First out collection of object .Push( ) .Pop( )

INNER JOIN

Most common type of join; includes rows in the query only when the joined field matches records in both tables.

Can a static method be overridden

No, because the static method is bound with class whereas instance method is bound with an object. Static belongs to the class area, and an instance belongs to the heap area

LEFT JOIN

Return all rows from the left table, and the matched rows from the right table

RIGHT JOIN

Return all rows from the right table, and the matched rows from the left table

Multiple Inheritance Not Supported in Java

Since compile-time errors are better than runtime errors, Java renders compile-time error if you inherit 2 classes. So whether you have same method or different, there will be compile time error.

Types of Inheritance

Single, Multilevel, Hierarchical

SDLC

Software Development Life Cycle The process of developing software through business needs, analysis, design, implementation and maintenance.

Access Modifiers

Specify accessibility (scope) of a data member, method, constructor or class. - Private - Public - Protected - Internal

Polymorphism

The ability of an object to take on many forms. The most common use occurs when a parent class reference is used to refer to a child class object.

Super Class

The class from where a subclass inherits the features. (base class or parent class)

SDLC - Testing

The code is tested at various levels. Unit, system, and user acceptance testing.

SDLC - Operations and Maintenance

The deployment of the system includes changes and enhancements before the decommissioning or sunset of the system.

SDLC - Design

The design functions and operations are described in detail, including screen layouts, business rules, process diagrams and other documentation.

TCL

Transaction Control Language: COMMIT, ROLLBACK, SAVEPOINT

Method Overriding

When a subclass/child class has the same method as declared in the parent class Used for runtime polymorphism

Collections

specialized classes for data storage and retrieval, provide support for stacks, queues, lists, and hash tables allocate memory dynamically to elements and accessing a list of items on the basis of an index create collections of objects of the Object class

Arrays

stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data. Consist of contiguous memory locations datatype[ ] arrayName = new datatype[num] datatype[ ] arrayName = { thing, thing, thing }

Exception Handling

try - a block of code for which particular exceptions is activated catch - one or more following try, a program catches an exception with an exception handler finally - used to execute a given set of statements, whether an exception is thrown or not thrown throw - a program throws an exception when a problem shows up


Set pelajaran terkait

Correlation Method - Naturalistic Observation - Case Studies

View Set

Princ of Marketing Exam 3, Prin of Marketing: Getting to know you (project 1), Prin. of Marketing: Cell Phones Test, Prin of Marketing: Get the word out, Prin of Marketing: Project 4, Prin of Marketing: Project 5

View Set

Chapter 11- Globalization, final written responses

View Set

Managerial Economics - Chapter 8

View Set