Super keyword in Java with uses and examples

What is Super keyword in Java A Super keyword in java is a keyword used to access immediate parent class instance variable, methods and constructors. java super keyword used in classes where inheritance hierarchy exists. Uses of super keyword in Java In Java super keyword is used when a sub class wants to refer its … Read more

Even or odd program in java

The number which is divisible by 2 is known as even number and the number which is not divisible by 2 is odd number. in programming we use % operator to check divisibility. The % operator returns the remainder of division. If a number is completely divisible its remainder is 0. So any number is … Read more

Splitting the strings in words

String reverse program in java

In Java, you can reverse a string in several ways. Here are three common methods to reverse a string: String reverse program in java using StringBuilder

This program uses the StringBuilder class, which is a mutable sequence of characters. Here’s how it works: Using a loop to reverse the string character by character:

Read more

Thread suspend() and resume() method in Java

suspend() : This method suspend a thread for sometime but do not kill/terminate it. resume() : This method revives the suspended thread.

Java Applet Example

To run applets we use  appletviewer . An appletviewer is command line program to invoke an applet program from command line. Here we will see how to run applet from applet viewer Example : Write a simple applet program to print “ Hello Students”

Compile  Save & Run:  Save this file with APDemo.java name. Compile : … Read more

How to Reverse a String in Java (5 Ways)

String reversal is changing the characters position from last to first in string. There are different ways to to achieve reversal. We will see them one by one. Using Loops (or Iterations) Usnig StringBuffer or StringBuilder ‘s reverse() Using toCharArray() of Array Using Recursion Using Collections Lets see different ways one by one 1 Reverse … Read more

Counting the number of characters and words in given string in Java

String regular expression using String.replaceAll()

We can replace a sub string using replaceAll() of String class To show this take one example: Consider We want to change a string result count value given like 1,420,000 we would like to change it to long value we directly convert it to long it will throw java.lang.NumberFormatException. To convert given string value to … Read more