100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

csci 2467 final Questions and Answers with complete solutions

Rating
-
Sold
-
Pages
13
Grade
A+
Uploaded on
25-08-2024
Written in
2024/2025

Encapsulation - a fundamental principle of object-oriented programming, whereby the internal components of a class are hidden from external classes and are only accessed via getter / setter methods. Why use encapsulation? - so that you can change the internal implementation of a class without affecting other classes. instantiation - Process of creating an object, an instance of a class; creates space in memory for the new object and binds a name for the object with the object's data in memory. OOP - programmers create classes to define new complex data types Class - a programmer defined data type. A class is a data type definition composed of attributes (or fields, properties, or instance variables) consisting of primitive data types and references to other class objects and methods that interact with these attributes. object - a specific instance of a class. Can be created via the new operator (instantiation) Object's attributes define what - the state of the object Object's methods define what - the behavior of the object A class consists of 3 parts - - 1. name 2. attributes (primitives and/or references to other class objects) 3. methods Getters - Methods for obtaining the value of an object's attributes. Setters - Methods for updating an object's attributes, but do not have a return ructor - Used to create objects of a class public method - visible to external classes private method - only visible within the class it is defined What is declared as private? What is declared as public? - Attributes are private, constructors, getters, and setters are public. programming dependency - a class that you write that can be used by other programmers. Heap Memory - Global properties in an object and objects themselves are stored in the "heap" area of a program's memory. Reference types are always on heap and it also has value types Stack Memory - Local method properties are stored in the "stack" area of memory. Data must have a known, fixed size. Has value types has-a relationship - association relationship between objects is-a relationship - inheritance relationship between objects. static variable - class variable and is shared by all instances of the class. static method - class method, not associated with one particular object. Can be called without having to create an instance of the class. static methods can access... - static variables, but cannot access instance ants are usually declared as... - both static and final. Immutable objects - Objects that cannot be changed once they are constructed. - fields are initialized via a constructor - all fields are private and final - no setters - all methods are final. Subclass (derived class and child class) - inheriting class superclass/base class/parent class - Inherited class Polymorphism - providing a single interface to entities of different types subtype polymorphism - methods written to operate on elements of a super type can also operate on elements of a subtype. Overriding the superclass method - a method in subclass with the same name and signature as a method in the superclass abstract class - contains one or more abstract methods, cannot be instantiated, if a subclass is not abstract, then the abstract methods from the parent class must be defined. abstract method - contains a declaration of the method with no method body. protected - access specifier (like private or public), protected attributes and methods are accessible within the class in which they are defined and are accessible to methods in only subclasses. override - used in subtype polymorphism, method in a subclass has the same name and same method signature as a method in the superclassoverload - used in ad hoc polymorphism, methods with the same name that are applied to parameters of different types. Object class - all classes are considered subclasses of the java object class, has several built-in methods available. Arrays - fixed length collection of objects what is each object in an array called? - element how to declare an array - int [ ] x - declares x to be an array of integers, x = new int[5] - creates array of 5 integers Why use arrays? - allows for arbitrary number of variables, easy aces of variable in a loop, allows for storing and manipulation of multiple copies of data.

Show more Read less
Institution
Csci 2467
Course
Csci 2467

Content preview

csci 2467 final
Encapsulation - a fundamental principle of object-oriented programming, whereby the internal
components of a class are hidden from external classes and are only accessed via getter / setter
methods.



Why use encapsulation? - so that you can change the internal implementation of a class without
affecting other classes.



instantiation - Process of creating an object, an instance of a class; creates space in memory for
the new object and binds a name for the object with the object's data in memory.



OOP - programmers create classes to define new complex data types



Class - a programmer defined data type. A class is a data type definition composed of attributes
(or fields, properties, or instance variables) consisting of primitive data types and references to other
class objects and methods that interact with these attributes.



object - a specific instance of a class. Can be created via the new operator (instantiation)



Object's attributes define what - the state of the object



Object's methods define what - the behavior of the object



A class consists of 3 parts - - 1. name 2. attributes (primitives and/or references to other class
objects) 3. methods



Getters - Methods for obtaining the value of an object's attributes.



Setters - Methods for updating an object's attributes, but do not have a return value.

, constructor - Used to create objects of a class



public method - visible to external classes



private method - only visible within the class it is defined



What is declared as private? What is declared as public? - Attributes are private, constructors,
getters, and setters are public.



programming dependency - a class that you write that can be used by other programmers.



Heap Memory - Global properties in an object and objects themselves are stored in the "heap"
area of a program's memory. Reference types are always on heap and it also has value types



Stack Memory - Local method properties are stored in the "stack" area of memory. Data must
have a known, fixed size. Has value types



has-a relationship - association relationship between objects



is-a relationship - inheritance relationship between objects.



static variable - class variable and is shared by all instances of the class.



static method - class method, not associated with one particular object. Can be called without
having to create an instance of the class.



static methods can access... - static variables, but cannot access instance variables.

Written for

Institution
Csci 2467
Course
Csci 2467

Document information

Uploaded on
August 25, 2024
Number of pages
13
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ACADEMICMATERIALS City University New York
View profile
Follow You need to be logged in order to follow users or courses
Sold
596
Member since
2 year
Number of followers
185
Documents
10571
Last sold
2 days ago

4.0

98 reviews

5
53
4
13
3
21
2
3
1
8

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions