Blog Archives
1 7 8 9 10 11 12 13 14 15

Java 7: Top 8 new features with examples

There are several small new features and enhancements in Java 7. The major features and enhancements are in Java 8. Let’s look at the Java 7 new features. #1: string in switch statement:

Output is:

#2 Binary integral literals

Output:

#3: Underscores for better readability in...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java 8 Functional Programming interview questions on currying

Currying (named after Haskell Curry) is the fact of evaluating function arguments one by one, producing a new function with one argument less on each step. Java 8 still does not have first class functions, but currying is “practically” possible with verbose type signatures, … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java 8 Functional Programming interview questions on Closures

Java 8 Functional Programming interview questions on Closures. Java 8’s support for closures is limited compared to other FP languages like JavaScript, Python, Scala, etc. Interviewers might be quizzing your understanding on this limitation. This extends Java 8 Functional Programming interview questions on currying. What is a Closure?… Read more...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java 8 String streams and finding the first non repeated character with functional programming

Q1.Find the first non repeated character in a given string input using Java 8 or later?
A1.Extends Find the first non repeated character in a given string input with Java 8 functional programming.

For example, an input string of “stress”

Read more ›



Java 8 using the Predicate functional interface

The java.util.function package in Java 8 has a number of functional interfaces. Let’s look at the Predicate interface that is used for filtering objects from a collection. Here is the Java 8 example: Step 1: Create a Driver domain class using the builder design pattern. … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java 8: 7 useful miscellaneous additions you must know

The much awaited addition in Java 8 are Lambda expressions to be used in functional programming and default and static methods in interfaces to support multiple behavior inheritance and helper methods. Here are a few other additional handy additions in Java 8. Addition #1: String.join( ) method, … Read more...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java 8: Different ways to sort a collection of objects in pre and post Java 8

The object we are going to sort is a Person.

Option 1: Writing your own Comparator implementation. This can be done as an anonymous inner class instead of a separate class.

The test class

Option 2: The Option 1 is not bad, … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java 8: Does “Optional” class alleviate the pain of ubiquitous NullpointerException?

The most prevalent runtime exception (aka unchecked) exception in Java is the NullPointerException. You need to code defensively to avoid NullPointerException as shown below. Later, we will see how the class java.util.Optional that was introduced in Java 8 will alleviate this problem to some extent. … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java abstract classes Vs interfaces Interview Q&As

Q1. When to use an abstract class over an interface? Q2. What is a diamond problem? Q3. Does Java support multiple inheritance? In design, you want the base class to present only an interface (or a contract) for its derived classes. … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java classes and interfaces are the building blocks

Q1. Which class declaration is correct if A and B are classes and C and D are interfaces? a) class Z extends A implements C, D{} b) class Z extends A,B implements D {} c) class Z extends C implements A,B {} d) class Z extends C,D implements B {}...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


Java coding practice problems – prime and powerful

There is no other way to pass the Java coding tests other than practicing. I have failed Java coding tests due to lack of practice. How often do you get work with tree and graph data structures? Ho often do you work with algorithms?

50+ Java coding practice problems Links:

Can you write code in Java?

Read more ›



Java Compile-time Vs Run-time Interview Q&As

During development and design, one needs to think in terms of compile-time, run-time, and build-time. It will also help you understand the fundamentals better. These are beginner to intermediate level questions.

Q1.

Read more ›



Java enum interview questions & answers

Covers the power of enumand 3 design patterns that can be applied with the help of enums. Q1. Why is it a best practice to use enums over static final int or String constants? A1. 1) static final allows invalid values. … Read more ›...

This content is for 100-Day-Full-Access, 200-Day-Full-Access, 365-Day-Full-Access, and 2-Year-Full-Access members only. Register 50+ Free Java FAQs 50+ Free Big Data FAQs
Already a member? Log in here


1 7 8 9 10 11 12 13 14 15

300+ Java Interview FAQs

Tutorials on Java & Big Data