Primitive Data Types Flashcards

(53 cards)

1
Q

Double

A

8 bytes, 10^308 range

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Float

A

4 bytes, 10^38 range

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Long

A

8 bytes, 10^18 range

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Short

A

2 bytes, 10^4 range

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Char

A

2 bytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Automatic conversion

A

automatic: small -> big

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Type Cast

A

big range -> small range

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Variables

A

location in memory that stores data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Condition

A

A question with 2 answers: true or false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Break

A

When executed, inner most loop that contains the break statement will be exited immediately

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Continue

A

When executed, remainder of current iteration will be skipped

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

String

A

a data type that stores a sequence if characters. OBJECT type NOT data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

StringBuilder

A

Another type to represent String info but is mutable (can be changed)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Pre-Increment/Decrement

A

++var (increments, then returns var)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Post-Decrement/Increment

A

var++ (returns var, increments)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Stack

A

Variables that are created in the main or other methods. References are on the stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Heap

A

New objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Parameters

A

Variables that are part of the function being called

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Arguments

A

Values that are passed in when a function call happens

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Stack Frames

A
  1. Created with each method call
  2. local variables and formal parameters are stored
  3. then destroyed after return
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Overloading

A

If two methods have the same name, but different signatures. Compiler selects proper method when calling overloaded method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Scope of Variables

A

The region in your code that you can use this variable. Defined by the block it is declared in.
- objects exist in the heap
- method calls go from one stack frame to another
- variables may have the same name but exist in different stack frames
- instance variables and local variables may have the same name

23
Q

Function Call Tracing

A

When a function is called, a stack frame is created and for all local vars. When done, it is destroyed

24
Q

Arrays

A

Objects that are dynamically created. May be assigned to variables of type Object. In the HEAP

25
Are Arrays Static?
Yes, they remain the same size once created
26
ArrayLists
Like StringBuilder, AL allow to grow and shrink their size. They are designed to store references to Objects
27
Formatted File Input
Most Important Steps: 1. Know the format (data type and layout) 2. How the data will be used (what kind if variables will be used) 3. Create objects to read file
28
Object Oriented Programming (OOP)
Encapsulates into objects: - data/state - methods Provide info hiding by separating implementation and interface
29
Implementation
Details hidden within the object
30
Private Instance Variables/Methods
Part of implementation
31
Interfaces
Allow objects to know how to communicate with one another
32
Public Methods and Constructors
Part of interface
33
Class
Unit of defining types - encapsulates data (instance variables) and behaviors (methods) - object instantiation (keyword NEW) and initialized by a constructor - class name is a new type
34
Instance Variables
Variables defined outside a method/ctor but within the class definition - usually PRIVATE
35
Class Variables
Variables defines using keyword STATIC (variable shared among all the objects that type - public static class variables can be accessed by an object
36
Local Vars
defined in a method body - CANNOT be public, probate, protected or static
37
Encapsulation
Data and methods
38
Inheritance
Keyword IMPLEMENTS (interface) and EXTENDS (implementation)
39
Polymorphism
Allows values if different data types to be handled using a uniform interface
40
Abstraction
Factoring out details so an object can be easily used without knowledge of how it works
41
Composition of classes
The idea if having one class be a data member or instance variable if another. HAS-A relationship
42
Superclass
Inherits attributes and behaviors of an existing class
43
Subclass
embellish these with new/different capabilities in a new class
44
Subclass and Superclass
Subclass object is a superclass object relationship NOT THE OTHER WAY AROUND - HAS-A relationship - superclass members become members of the subclass
45
Composition vs Inheritance
Inheritance: - IS-A relationship - create nee classes by extending
46
What to do in Subclass
- inherits all public and private members - can replace, hide, or supplement them with new members (override)
47
This
Used in class to indicate that calling object reference
48
Super
Used in a class to indicate that we call the super object’s method
49
Public
- Accessed by an Java code - Define public interface of the class
50
Private
- Only accessed when it occurs within the class - instance vars - often utility or helper methods
51
Protected
Access is permitted 1. from within the same package 2. Or within a subclass
52
Constructors
Methods that are called automatically to initialize instance vars for objects - same name as class - no return type - never inherited, no hiding/overriding - public, private, protected
53
Abstract Classes
- IS-A relationship - Cannot create instances of objects of abstract classes