MidTerm Flashcards

1
Q

Variable represented in

A

Unicode

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

Variable Name

A

must start with a character, and can include any unicode character

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

Two datatypes of Java

A

Primitive and Non-primitive

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

Primitive examples

A

byte, short, long, int, float, double, boolean and char

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

Non-primitive examples

A

String, Array, Classes

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

byte size

A

1 byte; -2^7 to 2^7 where 7 = 8 - 1

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

short size

A

2 byte; -2^15 to 2^15 where 15 = 2x8-1

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

int size

A

4 byte; -2^31 to 2^31 where 31 = 4x8-1

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

long size

A

8 byte; -2^(8x8-1) to 2^(8x8-1)

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

char size

A

2 byte

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

float

A

4 byte; 6 to 7 decimals

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

double

A

8 byte; 15 decimals

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

in Java, non-primitives are known as

A

reference types

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

Shortcut If then else

A

exp ? true : false

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

Strongly typed is

A

strict rule with data type conversion

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

Statically typed

A

safe and secure; it cannot ever be bound to an object of a different type

17
Q

Dynamically typed

A

unpredictable behavior; can be assigned to objects of different type

18
Q

Strings are

A

immutable

19
Q

If you wish to have a string you can change the value of you should use

A

Stringbuffer

20
Q

If i want to concat a string together how?

A

s=s.concat(“ appended”);

21
Q

A ______ is a non-primitive data type in Java, while an _______ is an instance of a class

A
class
object
22
Q

Why a class is the blueprint or template for an object ?

A

the complete syntax for handling encapsulation, abstraction, polymorphism, and inheritance

23
Q

before compilation file extension for class

A

.java

24
Q

after compilation file extension for class

A

.class

25
Q

during execution .class file is run

A

in the JVM

26
Q

syntax for methods that return a value

A

public returnType methodName(parameters){

}

27
Q

accessing attributes outside the class definition

A

.

myBestFriend._name = “Lara”;

28
Q

Formal parameters

A

are declared in the method heading

29
Q

+ UML Class Diagram

A

public

30
Q
  • UML Class Diagram
A

private

31
Q

Instance Variables

A

class variables basically

32
Q

what does a class variable hold?

A

a memory address

33
Q

what does a primitive variable hold?

A

a value

34
Q

Aliases

A

multiple class variables that have the same memory address. They point to the same object.

35
Q

Do not use _______ operator with two class variables

A

==. Use someClass.equals(otherClass);