Tagged: Java

Filewriter in java

FileWriter in java

In previous post, we have seen InputStream and OutputStream. In this post, we will see how to write data to a text file with the help of  FileWriter in java. FileWriter is a  character based classes unlike FileOutputStream which is used...

InputStream and OutputStream in java

InputStream and OutputStream in java

In this post , we will look at what is InputStream and OutputStream in java? In the previous post, we have seen I/O overview.Let’s understand them one by one. InputStream class: This is a...

IO in java

I/O in java

Java I/O is an API which is used to read and write data (Input and Output) and it is located in package called java.io.The Java IO package is primarily focused on input and output...

Different ways to reverse the string

Different ways to reverse String in java

There can be different ways to reverse the String. Here , we are mentioning few. Let’s understand them with example. 1. We can reverse the string by using a for loop and method charAt....

StringBuilder in java

StringBuilder in java

StringBuilder in java is like a String ,but which can be modified. It is same as StringBuffer, but only difference is that it is non-synchronized. The length of the String and content of sequence can...

StringBuffer class in java

StringBuffer class in java

StringBuffer class in java is like a String ,but which can be modified. The length of the String and content of sequence can be changed by using StringBuffer methods. It can be implemented in following...

String methods - matches and regionMatches

String methods – matches and regionMatches

In this post, we will discuss about the String methods – matches and regionMatches. boolean matches(String regex): It returns true if String matches the given regular expression. regex – the regular expression to which...

String methods - split

String methods – split()

In this post, we will discuss about the string methods – Split(). This method is used to split the string on the basis of given regular expression in arguments. It will return a String...

isempty and lastindexof

String methods – isEmpty() and lastIndexof

In this post, we will discuss about 2 methods which are isEmpty and lastIndexOf. Let’s understand them with examples. boolean isEmpty(): Returns true , if length of the string is 0. public class StringMethodsEx...

tostring,touppercase

String methods – toString,toUppercase,toLowercase,toChararray

In this post, we will discuss about the string methods toString,toUppercase,toLowercase,toChararray. Let’s see them one by one with examples. String toString(): This method returns itself i.e. a same string. public class StringMethodsEx { public static...