Category: Java

startswith and endswith

String methods – startsWith and endsWith

In this post, we will discuss 2 methods which are endsWith() and startsWith(). Let’s understand with examples. boolean endsWith(String suffix): This method checks if string ends with specified suffix. If ends with specified  suffix then returns...

concat and contains

String methods – Concat and contains

In this post, we will see 2 string methods which are  concat and contains. String concat(String str): The method appends a specified string to the end of this string. If the length of the string...

charat and compareto

String methods – charAt() and compareTo()

I this post, we will discuss about string methods charAt() and compareTo(). Let’s discuss them one by one with examples. charAt(): The method charAt(int index) returns the character at the specified index. Index should...

substring

String methods – substring

As its name says, it is used to get the substring from the any String. It has 2 types of implementations. String substring(int beginIndex) String substring(int beginIndex, int endIndex) Let’s look at them one...

trim and length

String methods – trim() and length()

I this post, we will discuss about the string methods – trim() and length(). Let’s understand them one by one with examples. trim(): The method trim() is used to remove leading and trailing white...

String method - indexof

String method- indexof

indexof method is used to find out the index of a particular character or Substring into the String. It has 4 type of different signatures. int indexOf(int ch) int indexOf(String str) int indexOf(int ch,int...

equals and equalignorecase

String methods – equals() and equalsIgnoreCase()

These methods are used to compare 2 string objects. If both String matches, returns true else false. Equals(): Equals is used to compare 2 strings and it is case sensitive. e.g. The Strings “JAVA” and...

String methods in java

String methods in Java

There are numerous string methods in java which are helpful for performing different and useful operations on Strings. Here is the table containing all the methods present in Strings. You can click on the methods name...

String in java

String in java

String is nothing but a sequence of characters. For example, “Book” is a string which is having sequence of 4 characters. There is a lot of importance of String and its usage in any programming language. In...

Call by value

Call by value in java

In java, we have only ‘Call by value’, not ‘Call by reference’. In ‘Call by reference’ the address of the value is passed in the arguments of the methods, so if any changes made...