Posts

Showing posts with the label Java

Java Array Interview Questions for Entry-Level Developers Part 01

1. What is a Java array? (Definition, purpose, characteristics: fixed size, contiguous memory) Definition A Java array is a data structure that allows storing multiple values of the same data type in a contiguous block of memory. It is a fixed-size collection of elements, each identified by an index. Purpose Arrays are used to efficiently store and manage a collection of data. They provide: Fast access to elements using an index. Memory efficiency since elements are stored contiguously. Characteristics Fixed Size When an array is declared, its size must be specified. The size cannot be changed dynamically (for dynamic collections, use ArrayList or other collections). Contiguous Memory Allocation Arrays are stored in a continuous block of memory, making access faster compared to linked lists. Indexed Access Elements are accessed using zero-based indexing, e.g., array[0] refers to the first element. Homogeneous Elements All elements in an array must be of the same data type. Efficien...

Message pubish in goolge cloud pubsub topic with java client

Image
Table Of Contents What is Pub/Sub? What are the benefits of using Pub/Sub? Core concepts of Pub/sub. How to publish a message in pub/sub topic in java with credentials? Shutdown publisher when application stop or no need publisher.  GitHub project link of reusable module.  How to publish and receive a message in pub/sub in cloud console? Conclusion.  What is Pub/Sub? Cloud Pub/Sub is a fully-managed messaging service provided by Google Cloud Platform. It is designed to provide reliable, scalable, and real-time messaging between applications and services. Cloud Pub/Sub allows you to publish and consume messages from any application or service, regardless of the language or platform they are built on. It provides a simple and flexible architecture that decouples your systems and allows them to work independently. In Cloud Pub/Sub, you can create one or more topics to which you can publish messages. Subscribers can then subscribe to the topic and receive all published messag...