Primitive Data Types Flashcards

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
Q

Are Arrays Static?

A

Yes, they remain the same size once created

26
Q

ArrayLists

A

Like StringBuilder, AL allow to grow and shrink their size.
They are designed to store references to Objects

27
Q

Formatted File Input

A

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
Q

Object Oriented Programming (OOP)

A

Encapsulates into objects:
- data/state
- methods
Provide info hiding by separating implementation and interface

29
Q

Implementation

A

Details hidden within the object

30
Q

Private Instance Variables/Methods

A

Part of implementation

31
Q

Interfaces

A

Allow objects to know how to communicate with one another

32
Q

Public Methods and Constructors

A

Part of interface

33
Q

Class

A

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
Q

Instance Variables

A

Variables defined outside a method/ctor but within the class definition
- usually PRIVATE

35
Q

Class Variables

A

Variables defines using keyword STATIC (variable shared among all the objects that type
- public static class variables can be accessed by an object

36
Q

Local Vars

A

defined in a method body
- CANNOT be public, probate, protected or static

37
Q

Encapsulation

A

Data and methods

38
Q

Inheritance

A

Keyword IMPLEMENTS (interface) and EXTENDS (implementation)

39
Q

Polymorphism

A

Allows values if different data types to be handled using a uniform interface

40
Q

Abstraction

A

Factoring out details so an object can be easily used without knowledge of how it works

41
Q

Composition of classes

A

The idea if having one class be a data member or instance variable if another. HAS-A relationship

42
Q

Superclass

A

Inherits attributes and behaviors of an existing class

43
Q

Subclass

A

embellish these with new/different capabilities in a new class

44
Q

Subclass and Superclass

A

Subclass object is a superclass object relationship NOT THE OTHER WAY AROUND
- HAS-A relationship
- superclass members become members of the subclass

45
Q

Composition vs Inheritance

A

Inheritance:
- IS-A relationship
- create nee classes by extending

46
Q

What to do in Subclass

A
  • inherits all public and private members
  • can replace, hide, or supplement them with new members (override)
47
Q

This

A

Used in class to indicate that calling object reference

48
Q

Super

A

Used in a class to indicate that we call the super object’s method

49
Q

Public

A
  • Accessed by an Java code
  • Define public interface of the class
50
Q

Private

A
  • Only accessed when it occurs within the class
  • instance vars
  • often utility or helper methods
51
Q

Protected

A

Access is permitted
1. from within the same package
2. Or within a subclass

52
Q

Constructors

A

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
Q

Abstract Classes

A
  • IS-A relationship
  • Cannot create instances of objects of abstract classes