[VV99] New Java 21 Certification, Java overloading, Schema Registry. Do you do PR?, Reading mind in eyes TEST
????? NEW JAVA CERTIFICATION: Java SE 21 Developer Professional
Exam Number: 1Z0-830
Oracle released a new Java certification exam targeting Java 21.
Note the presence of this new exam objective about virtual threads:
Managing Concurrent Code Execution
* Create both platform and virtual threads:
- Use both Runnable and Callable objects,
- manage the thread lifecycle, and
- use different Executor services and concurrent API to run tasks.
* Develop thread-safe code, using locking mechanisms and concurrent API.
* Process Java collections concurrently and utilize parallel streams.
#ocp #java #certification #java21
???JAVA CERTIFICATION QUESTION: overloading
Given:
package com.vv;
import java.time.LocalDate;
public class FetchService {
public static void main( String[] args ) throws Exception {
FetchService service = new FetchService();
String ack = service.fetch();
LocalDate date = service.fetch();
System.out.println( ack + " the " + date.toString() );
}
public String fetch() {
return "ok";
}
public LocalDate fetch() {
return LocalDate.now();
}
}
What will be the output?
* ok the 2024-07-10
* ok the 2024-07-10T07:17:45.523939600
* An exception is thrown
* Compilation fails
#java #certificationquestion #ocp
Compilation fails because
'fetch()' clashes with 'fetch()'; both methods have same erasure
'fetch()' is already defined in 'com.vv.FetchService'
The provided code will result in a compilation failure.
The reason is that the FetchService class has two methods named fetch with the same parameter list (i.e., no parameters).
In Java, method overloading requires the methods to have different parameter lists.
Since both fetch methods have identical signatures, this is not allowed.
Here is the problematic part of the code:
public String fetch() {
return "ok";
}
public LocalDate fetch() {
return LocalDate.now();
}
These two methods have the same name and parameter list, which leads to a compile-time error due to method signature conflict.
Therefore, the correct answer is:
Compilation fails
Official Oracle tutorial: Overloading Methods
The Java programming language supports overloading methods, and Java can distinguish between methods with different method signatures.
This means that methods within a class can have the same name if they have different parameter lists (there are some qualifications to this that will be discussed in the lesson titled "Interfaces and Inheritance").
??? QUOTE
Understanding Kafka (I mean Confluent) Schema Registry ??
Key Takeaways ??
Kafka Schema Registry is a powerful tool for managing data schemas in a Kafka-based architecture. While it introduces some complexity and performance overhead, its benefits in ensuring data consistency, versioning, and interoperability make it a valuable component in many data-driven applications.
Overview of the different formats used with Kafka Schema Registry:
Avro: Compact, fast, supports complex types, includes schema with data.
Protobuf: Efficient, supports multiple languages, schema not included with data.
JSON Schema: Human-readable, easy to debug, less compact.
#kafka #schema #registry
Clemens said:
The Apache Kafka project has no schema registry. You appear to be referring to a proprietary, shared source product component of the Confluent platform.
I replied:
Thank you for pointing that out! You're right, Apache Kafka doesn't include a built-in schema registry. I was referring to the Confluent Schema Registry. For those not using Confluent, alternatives like Karapace or Redpanda are available. Thanks again! Best regards,
Sarwar shares this idea:
Schema registry doesn't validate your data or schema changes. It checks schema compatibility via clients' serializers or deserializers, but clients can bypass this. Kafka doesn’t enforce data validation, lacking a broker-end interceptor. Confluent Server only verifies schema ID validity, not the data itself.
POLL: Do you use Pull Requests in your team? YES/ NO
According to Java champion Gunnar Morling: "Pull requests are great for low-trust environments like OSS with many external contributors. For stable teams e.g. in-house, I feel that they are too wasteful of a process and slow. Make sure to have alignment on the big picture, anything else can also be improved after merging"
Twitter link of Gunnar Morling's statement: https://lnkd.in/e5uPwkiu
Soft skills: ??Are you good at reading the mind in the eyes? TEST YOU??
For each set of eyes, choose which word best describes what the person in the picture is thinking or feeling. You may feel that more than one word is applicable, so choose the word which you consider to be the most suitable. Before making your choice, make sure that you have read all four words. Try to do the task as quickly as possible, but you will not be timed.
?? JOKE: Git merge of an old branch ???