Java

Java FutureTask Example Program — step-by-step Programming tutorial on Progressive Robot

Java FutureTask Example Program

URL: https://www.progressiverobot.com/java-futuretask-example-program/ Sometime back I wrote a post about [Java Callable Future](/community/tutorials/java-callable-future-example) interfaces that we can use to get the concurrent processing benefits of threads as well as they are capable of returning value to the calling program. FutureTask is base concrete implementation of Future interface and provides asynchronous processing. It contains the methods to […]

Read more
Java NullPointerException - Detect, Fix, and Best Practices — step-by-step Programming tutorial on Progressive Robot

Java NullPointerException – Detect, Fix, and Best Practices

URL: https://www.progressiverobot.com/java-lang-nullpointerexception/ java.lang.NullPointerException is one of the most popular [exceptions in java](/community/tutorials/exception-handling-in-java) programming. Anybody working in java must have seen this popping out of nowhere in the java standalone program as well as the [java web application](/community/tutorials/java-web-application-tutorial-for-beginners). java.lang.NullPointerException NullPointerException is a runtime exception, so we don’t need to catch it in the program. NullPointerException is raised in an […]

Read more
Java RandomAccessFile Example — step-by-step Programming tutorial on Progressive Robot

Java RandomAccessFile Example

URL: https://www.progressiverobot.com/java-randomaccessfile-example/ Java RandomAccessFile provides the facility to read and write data to a file. RandomAccessFile works with file as large [array of bytes](/community/tutorials/string-byte-array-java) stored in the file system and a cursor using which we can move the file pointer position. Java RandomAccessFile !Java RandomAccessFile, RandomAccessFile in java, Java RandomAccessFile read write append example RandomAccessFile […]

Read more
How to Sort a List in Java — step-by-step Programming tutorial on Progressive Robot

How to Sort a List in Java

URL: https://www.progressiverobot.com/java-sort-list/ Sometimes we have to sort a list in Java before processing its elements. In this tutorial, we will learn how to sort a list in the natural order. We will also learn how to use our own Comparator implementation to sort a list of objects. Java List is similar to arrays except that […]

Read more
Java Thread Join Example — step-by-step Programming tutorial on Progressive Robot

Java Thread Join Example

URL: https://www.progressiverobot.com/java-thread-join-example/ Java Thread join method can be used to pause the current thread execution until unless the specified thread is dead. There are three overloaded join functions. Java Thread join ![java thread join, thread join example, java thread join example, thread join](images/java-thread-join-example-section-1.png) public final void join(): This java thread join method puts the current […]

Read more
Java SE 8 Interview Questions and Answers (Part-1) — step-by-step Programming tutorial on Progressive Robot

Java SE 8 Interview Questions and Answers (Part-1)

URL: https://www.progressiverobot.com/javase8-interview-questions-part1/ In this post, we are going to discuss some important [Java SE 8](/community/tutorials/java-8-features-with-examples) Interview Questions with Answers. I will write one more post to discuss the remaining Java SE 8 Interview Questions. Java 8 Interview Questions Why do we need change to Java again? Java SE 8 New Features? Advantages of Java SE […]

Read more
JUnit Setup Maven - JUnit 4 and JUnit 5 — step-by-step Programming tutorial on Progressive Robot

JUnit Setup Maven – JUnit 4 and JUnit 5

URL: https://www.progressiverobot.com/junit-setup-maven/ JUnit 4 and JUnit 5 are completely different frameworks. They both serve the same purpose, but the JUnit 5 is a completely different testing framework written from scratch. It's not using anything from JUnit 4 APIs. Here we will look into how to setup JUnit 4 and [JUnit 5](/community/tutorials/junit5-tutorial) in our maven projects. […]

Read more
Mockito Mock Void Method — step-by-step Programming tutorial on Progressive Robot

Mockito Mock Void Method

URL: https://www.progressiverobot.com/mockito-mock-void-method/ Most of the times Mockito when() method is good enough to mock an object's behavior. But when we have to mock a void method, we can't use when(). Mockito Mock Void Method Mockito provides following methods that can be used to mock void methods. doAnswer(): We can use this to perform some operations […]

Read more
Pyramid Pattern Programs in Java — step-by-step Programming tutorial on Progressive Robot

Pyramid Pattern Programs in Java

URL: https://www.progressiverobot.com/pyramid-pattern-programs-in-java/ Pattern programs are used a lot in interviews to understand the logical thinking abilities of the interviewee. Pyramid patterns are very popular and once we get the logic on the way it's created, writing code to achieve the same is an easy task. Pyramid Pattern Programs in Java !Pyramid Pattern Programs in Java […]

Read more
How to Sort a HashMap by Value in Java? — step-by-step Programming tutorial on Progressive Robot

How to Sort a HashMap by Value in Java?

URL: https://www.progressiverobot.com/sort-hashmap-by-value-java/ HashMap in java provides quick lookups. They store items in "key, value" pairs. To get a value from the HashMap, we use the key corresponding to that entry. HashMaps are a good method for implementing Dictionaries and directories. Key and Value can be of different types (eg – String, Integer). We can sort […]

Read more
CHAT