How to find String length in java Length() & without string method

Get String length with String length() method To find String length in java there is a method length(). This method is used to get the length of the string. The signature of length method is:

The length method returns the length of the string. it counts the number of Unicode in string. str.length java … Read more

User Defined exception in Java | Java custom exception with examples

In Java programming, it is possible to create our own exceptions and such exception are called user-defined exceptions in Java. Exception class is a predefined class. Any user-defined exception created by us must be a subclass of the predefined Exception class and created by extending the Exception class. Read More Exception Handling in Java: Hierarchy … Read more

Throw and Throws Keywords in Java

In java programming, If the exception occurs within the try block it is thrown. Throw and Throws Keywords in Java is very important to throw exceptions. a throw keyword is used to throw an exception A system-generated exception is automatically thrown by the java run time system but if we want to manually throw an … Read more

Java string replace:string character whitespace vowel regex

Here we will see Java string replace examples with replacing the string, replacing characters, replacing whitespace vowels, and using a regular expression to replace string and substring. Java string replace Example: use of replace() Java String replace() is used to replace substring in given string.

In this example, Joker is replaced with Poker and … Read more

Methods in Java-how to call a method in java

Introducing Method In java programming language classes usually consist of two things instance variable and methods. What is a method in java                                                                  A method is the block of statements that performs a special task. Using methods we can avoid rewriting the same code over and over in a sane program. The method increases the … Read more

Applet Life Cycle in Java with Example

Applet in Java Applet in Java is a special Java program that are primarily used in a internet programming. Applet Life Cycle is very important to know in Java Applet Programming.  As we have already seen how to run program from command prompt, but there were no GUI. To provide Graphical user interface(GUI) Java Applet … Read more

Write a java program to reverse a string

We are discussing java program to reverse a string using following ways Java program to reverse a string using StringBuffer or StringBuilder class Java program to reverse a string using Loops(Iteration) Java program to reverse a string using StringBuffer or StringBuilder class

Output

Java program to reverse a string using Loops(Iteration) Copy and … Read more

Exception Handling try catch finally blocks in Java

What is try block A try block is used to surround a set of statements where exceptions may occur. A try block used with catch and finally block Also Read Exception Handling in Java: Hierarchy Example and Types What is a catch block A catch block is created followed by a try block. Whenever an … Read more

Thread Life Cycle in Java

Thread Life Cycle in Java tells the various information of thread form born to terminate. Thread life cycle contains the several stages and at a time any thread can be present¬† in a single state. States of Thread life cycle Born Ready Running Blocked Sleep Wait Dead Ready:  In this state thread is ready to … Read more