Java Basics Flashcards

1
Q

What is the difference between JDK & JRE

A

JDK stands for Java Development Kit. It provides all the tools and libraries for the development of Java applications. JDK also contains compilers and debuggers. JRE stands for Java Runtime Environment, it is included in the JDK. It provides libraries and the Java Virtual Machine that is required to run a Java program.

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

What is the JVM?

A

Java Virtual Machine is an abstract machine that executes Java Bytecode. There are different JVM’s available for different platforms, so JVM is platform dependant. JVM loads, verifies and executes Java Bytecode. Most popular JVM is HotSpot from Oracle.

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

What are the different memory areas allocated by JVM?

A

Classloader, Class (Method) Area, Heap, Stack, Native Method Stack.

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

What is the Classloader?

A

It is a component of JVM used to load class files.

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

What is Class (Method) Area?

A

It stores per-class structures such as the runtime constant pool, field and method data, and the code for methods.

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

What is the Heap?

A

Memory that is created at runtime and it contains the runtime data area in which objects are allocated.

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

What is the Stack?

A

Stack stores local variables and partial results at runtime.

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

What is the Native Method Stack?

A

The area is reserved for all the native methods used in the application.

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

What is write once run anywhere?

A

Java is a platform independent library. Byte code generated by Java compiler can be interpreted by any JVm. Java compiler javac compiles java code and JVM runs that code.

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

What are the different Classloaders?

A

Bootstrap, Extension and Application

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

What is the Bootstrap Classloader?

A

The bootstrap Classloader loads all the classes from the rt.jar file.

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

What is the Extension Classloaders?

A

It loads class files from jre/lib/ext location.

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

What is the Application Classloader?

A

This Classloader depends on the CLASSPATH to find the locations of class files.

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

If we do not specify a value for local variables, what will be their default value?

A

Java does not initialise variables with a default value. So it will be null.

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