Java Flashcards

1
Q

What is a Instant data type in Java?

A

Class Instant
An instantaneous point on the time-line.

The Instant class represents a moment on the timeline in UTC with a resolution up to nanoseconds.

String output = instant.toString();
You will get a value such as 2011-12-03T10:15:30.987654321Z, standard ISO 8601 format.

This class models a single instantaneous point on the time-line. This might be used to record event time-stamps in the application.

The range of an instant requires the storage of a number larger than a long. To achieve this, the class stores a long representing epoch-seconds and an int representing nanosecond-of-second, which will always be between 0 and 999,999,999. The epoch-seconds are measured from the standard Java epoch of 1970-01-01T00:00:00Z where instants after the epoch have positive values, and earlier instants have negative values. For both the epoch-second and nanosecond parts, a larger value is always later on the time-line than a smaller value.

https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html

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

What is an EPOC

A

The name EPOC comes from the word epoch (the beginning of an era).

In computing, an epoch is a date and time from which a computer measures system time. … For instance, Unix and POSIX measure time as the number of seconds that have passed since Thursday 1 January 1970 00:00:00 UT, a point in time known as the Unix epoch

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

How to check for an empty string and give it a different value?

A

this.initiativeGsi1Pk = StringUtils.isEmpty(gsi1Pk) ? INITIATIVE_PK_VALUE : gsi1Pk;

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

What is the JRE?

A

JRE is a piece of a software which is designed to run other software. It contains the class libraries, loader class, and JVM. In simple terms, if you want to run Java program you need JRE. If you are not a programmer, you don’t need to install JDK, but just JRE to run Java programs. Though, all JDK versions comes bundled with Java Runtime Environment, so you do not need to download and install the JRE separately in your PC. The full form of JRE is Java Runtime Environment.

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

What is JVM?

A

JVM is an engine that provides a runtime environment to drive the Java Code or applications. It converts Java bytecode into machine language. JVM is a part of Java Run Environment (JRE). It cannot be separately downloaded and installed. To install JVM, you need to install JRE. The full form of JVM is Java Virtual Machine.

In many other programming languages, the compiler produces machine code for a specific system. However, Java compiler produces code for a virtual machine which is called as JVM.

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

What are the key differences between JVM and JRE?

A
  • JDK is a software development kit whereas JRE is a software bundle that allows Java program to run, whereas JVM is an environment for executing bytecode.
  • The full form of JDK is Java Development Kit, while the full form of JRE is Java Runtime Environment, while the full form of JVM is Java Virtual Machine.
  • JDK is platform dependent, JRE is also platform dependent, but JVM is not platform independent.
  • JDK contains tools for developing, debugging, etc. JRE contains class libraries and other supporting files, whereas software development tools are not included in JVM.
  • JDK comes with the installer, on the other hand, JRE only contains the environment to execute source code whereas JVM bundled in both software JDK and JRE.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly