Basic Flashcards

1
Q

Explain the JVM

A

An abstract machine. Provides a runtime environment where java bytecode is executed

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

Explain the JRE

A

An environment where java bytecode can be executed

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

Explain “main” in public static void main

A

Name of the method searched by the JVM as the starting point. Args are the parameters passed

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

What are wrapper classes?

A

Wrapper classes wrap a class or structure and implements other useful methods. They encapsulate the data or primitive type

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

What are constructors in Java?

A

A block of code to initialize an object. There are 2 types default constructors don’t need to be explicitly written. Parameterized constructors need parameters to init the object

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

What is a singleton class

A

A singleton is a design pattern first of all. It is a class that only can have one instance at a time in one JVM. You can achieve this by making a constructor private

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

ArrayList vs Vector

A

ArrayList : is not synchronized. Faster. Grows by 50% of its size. Can only use iterator to traverse
Vector: Is synchronized and slow. Defaults to doubling the size of array.

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

Heap Memory

A

Heap memory is used by all parts of the application. Objects on the heap are globally accessible. Memory lives from start to end of application. All objects are placed on the heap

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

Stack Memory

A

Memory is used by one thread of execution. This memory can’t be accessed from other threads. Exists for duration of the executed thread. Memory only contains local primitive and references in heap space

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

What is the synchronized

A

Capability to control the access of multiple threads to shared resources.

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

Interface vs Abstract

A

If you have common code use an abstract class. If the implementation code aren’t the same

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

What is JIT compiler

A

This compiler is used to improve performance. JIT will compile part of the the byte code that have similar functionality at the same time

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