BNYM QC Flashcards
1
Q
- What is the new feature in Java 11 that allows the type of lambda parameters to be inferred using the ‘var’ keyword?
A
- “Local-Variable” Syntax
2
Q
- What new String methods were introduced?
A
- isBlank()
- lines()
- strip()
- stripLeading()
- stripTrailing()
- repeat()
3
Q
- What Collection related method was introduced?
A
- Collection.toArray(IntFunction)
- It is a default method added to the Collection Interface
4
Q
- What other notable Java 11 features have been added or changed?
A
- New File Methods
- Not Predicate Method
- HTTPClient
- Can directly run Java source files with “java” CLI tool
5
Q
- What is Pattern Matching? Which version of Java introduced it?
A
- Used to test if an object has a particular structure and if so, then that data is extracted from that object
- Introduced in Java 14
-Added support for switch expressions
6
Q
- What improvements did Java 17 add to Garbage Collection?
A
- Parallel GC is much faster
- Improved heap allocation to the G1GC
- Introduced ZGC, which provides low latency and minimal pauses
7
Q
- What is the purpose of the Java Platform Module System (JPMS)?
A
- To encapsulate Java code into modules, making it easy to maintain large scale Java applications.
8
Q
- What is a module in JPMS? How is it different from a regular Java package?
A
- A module is a unit of code that contains Java packages and resources.
- It’s different from a Java package because it provides stronger encapsulation, which means only the specified parts of a module are accessible, and the rest remain hidden.
9
Q
- What is a module descriptor in JPMS? What information does it contain?
A
- A file that describes the content and dependencies of a module.
- It contains information such as the module name, packages it exports which make it accessible to other modules, and other optional configurations.
10
Q
- What are the benefits of using JPMS in terms of security and performance?
A
- Security, JPMS enforces strong encapsulation, which helps prevent unauthorized access to internal code.
- Performance, JPMS allows Java runtime to analyze and optimize module dependencies, resulting in more efficient loading of code.
11
Q
- What is the debugger?
A
- A tool used to identify and resolve issues or bugs in software code.
- It allows us to step through code line by line, inspect variables, and observe the program’s behavior in order to understand and fix any problem.
12
Q
- What is a breakpoint?
A
- An international stopping point at a specific line of code
- By stopping the program’s execution the developer can inspect variables at the given point.
13
Q
- Step Into vs Step Over vs Step Return?
A
- Step Into goes inside the methods used in the current line; else it proceeds to the next line.
- Step Over operation process the current line and proceeds to the next line.
- Step Return operation finishes the current method and takes us back to the calling method.
14
Q
- What is variable inspection?
A
- Returns the value of any method that is called in the current context.
15
Q
- Difference between a Collection and a Stream? What are the benefits of Stream API?
A
- Collection is a framework that provides architecture to store and manipulate a group of objects, providing many interfaces such as set, list, queue, dequeue and classes such as ArrayList, LinkedList and more.
- Stream is a sequence of objects that support various methods which can be pipelined to produce the desired result.
- Benefits: Streams do not change the original data structure, succinctly express sophisticated behavior.