Java

Let’s learn java delete file. Java delete file To delete a file in java delete() method of File class is used. delete() method deletes the file or directory denoted by this abstract pathname. Syntax: public boolean delete() Returns: true if and only if the file or directory is successfully deleted; false otherwise. If this pathname…

Read More Java delete file

Let’s learn encapsulation in java. Encapsulation in java Encapsulation is a procedure of wrapping variables and methods together into a single unit. Encapsulation is one of the four fundamental Object Oriented Programming(OOPS) concept. Other three oops concept are polymorphism, inheritance and abstraction. In encapsulation variables and methods in a class are hidden from other classes…

Read More Encapsulation in java

Let’s learn String indexOf(String str, int fromIndex) method in java. String indexOf(String str, int fromIndex) method in java String indexOf(String str, int fromIndex) method returns the index within this string of the first occurrence of the specified substring, starting at the specified index. Syntax: public int indexOf(String str, int fromIndex) Parameters: str the substring to…

Read More String indexOf(String str int fromIndex) method in java

Let’s learn String toLowerCase(Locale locale) method in java. String toLowerCase(Locale locale) method in java String toLowerCase() method returns the String, converted to lowercase. This is equivalent to calling toLowerCase(Locale.getDefault()). Syntax: public String toLowerCase() Now let’s see example on String toLowerCase() method. import java.util.*; public class StringToLowerCaseMethodExample { public static void main(String[] args) { String str…

Read More String toLowerCase(Locale locale) method in java

Let’s learn TreeSet headSet(E toElement) method in java. TreeSet headSet(E toElement) method in java headSet(E toElement) method of TreeSet class returns a view of the portion of this set whose elements are strictly less than toElement. Syntax: public SortedSet<E> headSet(E toElement) Parameters: toElement high endpoint (exclusive) of the returned set. Throws: ClassCastException – if toElement…

Read More TreeSet headSet(E toElement) method in java

Let’s learn TreeSet headSet(E toElement, boolean inclusive) method in java. TreeSet headSet(E toElement, boolean inclusive) method in java headSet(E toElement, boolean inclusive) method of TreeSet class returns a view of the portion of this set whose elements are less than(or equal to, if inclusive is true) toElement. Syntax: public NavigableSet<E> headSet(E toElement, boolean inclusive) Parameters:…

Read More TreeSet headSet(E toElement boolean inclusive) method in java