Thread stop method in Java

In java, stop()  method  kills/terminates  the currently executing thread.

Result

Description: in the above program, when value of variable i=3 then stop() method terminates the curently executing thread and come out of the loop.

Thread Yield method in Java

In java, yield()  method  temporarily pause  the currently executing thread object  and allow other threads to execute.

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 

Here: class- is write to create a class. class_name – is the name of the class. It is an … Read more

Character Stream I/O in Java

In a java programming, like a Byte stream Character stream is also used for input-output for 16 bit. But Byte streams are used to perform input and output of 8-bit. Most common Character streams classes are, FileReader and FileWriter.  FileReader- FileReader uses for reads two bytes at a time.  FileWriter– FileWriter uses for writes two bytes at a … 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

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

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