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 import java.util.Scanner; public class ReverseString { public static void main(String[] args) { Scanner … Read more

Thread stop method in Java

In java, stop()  method  kills/terminates  the currently executing thread. class A extends Thread { public void run() { for (int i = 1; i

Thread Yield method in Java

In java, yield()  method  temporarily pause  the currently executing thread object  and allow other threads to execute. class A extends Thread { public void run() { for (int i = 1; i

Basics of Applet in Java

The Java Applet is a special Java program that are primarily used in a internet programming. Applet program runs on a web browser at client side. Applet program are used to make the web site more dynamic. Applet program embedded in a HTML page and hosted on a web server. Applet Skeleton/ Structure Applet skeleton … Read more

Java Program Structure and First Program

Here we will see the structure of the java program and create a java first program in notepad and run it 1. Structure of Java Program Let’s see the basic structure of the java program  class className { //main method of java program public static void main(String args[]) { //program execution starts from main method … 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

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 public class StringReverseExample { public static void main(String[] args) { String original = “Hello, World!”; StringBuilder reversed = new StringBuilder(original).reverse(); String reversedString = reversed.toString(); System.out.println(“Reversed string: ” + reversedString); … 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. class A extends Thread { public void run() { for (int i = 1; i

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” import java.applet.Applet; import java.awt.Graphics; /* */ public class APdemo extends Applet { String … 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