Number Pattern Programs In Java : Java programs to print the numbers or any other symbols in different patterns are one of the frequently asked interview programs mostly for freshers. Because, they test the candidate’s logical ability as well as coding skills which are ‘must have skills’ for any software engineer. In this post, I have …

Continue reading 20 Different Number Pattern Programs In Java

The given ArrayList can be reversed using Collections.reverse() method. Collections class is an utility class in java.util package which provides many useful methods to operate on Collection classes. Collections.reverse() method reverses the elements of the given ArrayList in linear time i.e it has the time complexity of O(n). Collections.reverse() method takes List type as an argument. So you …

Continue reading How To Reverse An ArrayList In Java?

Problem : Write a java program or function to sort a text file containing some records in single or multiple columns. Your program should take one text file containing some records as input, should sort the records on a particular column and write the sorted records in another text file. See the below image. How To Sort …

Continue reading How To Sort A Text File In Java? – Example Program

Array and ArrayList are two most frequently used data types in java. Array is old derived type which can hold primitive types as well as objects where as ArrayList is a part of Java Collection Framework which holds only objects. One more difference is that array is of fixed size. You can’t change its size …

Continue reading Array To ArrayList And ArrayList To Array In Java With Examples

While methods represent the behavior of an object, variables represent the state of an object. Variables may be of two types – Class variables and Instance Variables. Class variables are common to all instances of that class where as instance variables are specific to an object. Let’s discuss class variables and instance variables in java and difference between …

Continue reading Difference Between Class Variables And Instance Variables In Java

Problem : Write a java program or function to find the longest substring without repeating characters in a given string. For example, if “javaconceptoftheday” is the input string, then the longest substring without repeating or duplicate characters is “oftheday” and its length is 8. How To Find Longest Substring Without Repeating Characters In Java? Step …

Continue reading How To Find Longest Substring Without Repeating Characters In Java?

There are six thread states in java. They are NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING and TERMINATED. At any point of time, a thread will be in any one of these six states. In these six states, BLOCKED and WAITING states are closely related. In this post, we will discuss the differences between BLOCKED Vs WAITING states in java. BLOCKED And WAITING States …

Continue reading Difference Between BLOCKED Vs WAITING States In Java