Array and ArrayList are two important and most used data structures in java. Array is a basic data structure which is the part of Java from the beginning. ArrayList is a class in Java Collection Framework which is introduced from JDK 1.2. You can describe ArrayList as an advanced version of Array. Because, array is a …

Continue reading Differences Between Array Vs ArrayList In Java

SimpleDateFormat class of java.text package is used to format the given Date object in the desired pattern. This class has two important methods – parse() and format(). parse() method is used to convert the string to Date in java and format() method is used to format the Date object in desired patterns like dd-MM-yyyy, yyyy/MM/dd hh:mm:ss etc. This …

Continue reading How To Format Date In Java?

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?