Holy Java Moly Flashcards

1
Q

JVM

A

abstract machine. a specification that provides runtime environment in which bytecode can be executed

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

JRE

A

runtime environment which implements JVM and provides all class libraries and oter files taht JVM uses at runtime

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

JDK

A

tool necessary to compile, document and package Java programs. completely includes JRE

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

Synchronization

A

process which keeps all concurrent threads in execution to be in sync. avoids memory consistency errors caused due to inconisistent view of shared memory

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

Thread

A

path of execution for a process. can run concurrently and is controlled by programmer compared to processes

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

Wrapper Classes

A

each of java’s 8 primitive data types has a class dedicated to it. they “wrap” primitive data type into an object of that class.

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

The 8 Primitive Types

A

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

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

Boxing

A

constructing the object

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

unboxing

A

extracting value from object.

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

autoboxing

A

converting primitive type to wrapper

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

OOPS

A

objects. can also pass by reference primitives

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

final

A

used to apply restrictions on class, method and variable. class can’t be inherited, method can’t be overridden and variable value cant be changed

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

finally

A

used to place important code, it will be executed whether exception is handled or not

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

finalize

A

used to perform clean up processing just before object is garbage collected. gc throws away objects that are no longer used. override finalize to utilize

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

StringBuffer

A

operations are thread-safe and synchronized. to be used when multiple threads are working on same String and StringBuilder in single threaded environment.

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

StringBuilder

A

not thread-safe. performance is faster because of no overhead of synchronized

17
Q

String vs StringBuilder/Buffer

A

immutable vs mutable

18
Q

stack memory

A

used only by 1 thread of execution. can’t be accessed by other threads. follows LIFO manner to free memory. exists until end of execution of thread. only contains local primitive variables and reference variables to objects in heap space

19
Q

heap memory

A

used by all parts of the application. objects stored are globally accessible. memory management based on generation associated to each object. lives from start til end of app execution. whenever object is created, it’s always stored in heap space

20
Q

arraylist

A

not syncrhonized and fast. increases by 50% if element is inserted. does not define increment size. can only use Iterator for traversing an ArrayList

21
Q

vector

A

synchornized. slow and thread safe. doubles size of array when adding. defines the increment size. except hashtable, vectory is only other class which uses both Enumeration and Iterator

22
Q

hashmap

A

non synchronized and not thread safe. allows 1 null key and multiple null values. faster, traversed by Iterator. inherits AbstractMap class. can synchronize by calling Collections.synchronizedMap(hashMap)

23
Q

hashtable

A

synchronized. thread-safe and can be shared with many threads. doesn’t allow any null key/value. slow, internally synchronized and can’t be unsynchronized. traversed by Enumerrator and Iterator. inherits Dictionary class

24
Q

equals()

A

defined in Object class and used for checking equality of two objects defined by business logic. COMPARES VALUES THEMSELVES

25
Q

==

A

binary operator in Java used to compare primitives and objects. COMPARES REFERENCES