Blog Archives

01: Java data types interview Q&As

Q1. How would you go about choosing the right data types for your application?
A1. Java is what is known as a strongly typed language. This means Java only accepts specific values within specific variables or parameters. Some languages, such as JavaScript, PHP, and Perl are weakly typed languages.…



02: 10 Java String class interview Q&As

Java Collection interview questions and answers and Java String class interview questions and answers are must know for any Java developer as these two APIs are the most frequently used in your Java application code. You can’t write any decent Java application without these 2 APIs.

Q1. What will be the output of the following code snippet?…



03: Java autoboxing & unboxing benefits & caveats interview Q&As

Q1. What do you understand by the terms “autoboxing” and “autounboxing” in Java? A1. Java automatically converts a primitive type like “int” into corresponding wrapper object class Integer. This is…



04: Java primitives & objects memory consumption

Q1. How much memory space does a primitive type int occupy in Java? A1. 4 bytes. Q2. Java objects get stored in the heap memory space, but how about the…



05: Java Date and Time Interview Q&As

Q1. What is wrong with old Java.util.Date & java.util.Calendar/java.sql.* APIs and why should joda-time & Java 8 libraries favored? A1. Old Java.util.Date & java.util.Calendar/java.sql.* -> Joda-Time (Pre Java 8) ->…



06: Understanding TimeZones with Java 8 examples

What is UTC? which stands for Coordinated Universal Time. The diagram below shows the standard time offsets of different countries. Some places observe daylight saving time (DST) during their respective summer periods. For example,

Los Angeles (i.e LA) UTC – 8.0 hours (without DST) & UTC – 7.0 hours (with DST)

Berlin UTC + 3.0 hours (without DST) & UTC + 2.0 hours (with DST).…



Convert Java Date/Time to String & String back to Date/Time

#1. Why convert a Date to String & a String back to Date

(a) Convert a String input from say a file date, so that you can perform operations like

1) Adding 5 days to the date.
2) Comparing a date like before, after, equal, etc.

(b) Convert a Date back to String, so that you can represent the date in different formats like dd/MM/yyyy, dd/MMM/yyyy, yyyy-MM-dd, etc.…



Converting String to Amount and Amount to String

#1. Does Java have a “Money” class? No. This will change in Java 9 with the “Money API”. JSR 354 defines a new Java API for working with Money and…



Generating a UUID (aka GUID) in Java

UUID stands for Universally Unique ID. A UUID is known in the Microsoft world as as a GUID.

What does a UUID look like?

The UUID is not a string, but a 128-bit value. The UUID is a hexadecimal value like

How to generate a UUID in Java?


800+ Java & Big Data Interview Q&As

200+ Java & Big Data Tutorials

Top