100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

csci 2467 final Questions and Answers with complete solutions

Beoordeling
-
Verkocht
-
Pagina's
13
Cijfer
A+
Geüpload op
25-08-2024
Geschreven 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.

Meer zien Lees minder
Instelling
Csci 2467
Vak
Csci 2467

Voorbeeld van de inhoud

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.

Geschreven voor

Instelling
Csci 2467
Vak
Csci 2467

Documentinformatie

Geüpload op
25 augustus 2024
Aantal pagina's
13
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
ACADEMICMATERIALS City University New York
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
596
Lid sinds
2 jaar
Aantal volgers
185
Documenten
10571
Laatst verkocht
2 dagen geleden

4.0

98 beoordelingen

5
53
4
13
3
21
2
3
1
8

Populaire documenten

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen