Finally, Block in Java

Finally, Block in Java

Finally, Block in Java Finally blocks(finally{}) are executed once the try block(try{}) exits. This block executes even after unexpected exceptions(errors) have occurred. Irrespective of the try block, the expression in the finally block(finally{})  is always executed. This block(finally{}) is built with the capability of recovering lost data and preventing the leak of resources. On closing … Read more

Bubble Sort in C

Bubble Sort in C

Bubble Sort in C Bubble sorting is the most popular sorting technique because it is very simple to understand and implement. The algorithm achieves its name from the fact that with each iteration, the largest value moves like a bubble to the top of the array. The bubble sort method is not efficient for large … Read more

Add  Border to  JPanel

Add Border to JPanel

Add  Border to  JPanel Borders are basically margined around the edges of a Swing component. Borders are useful for providing titles and empty spaces around components. The setBorder() is used to put a border around a component. Borders in JPanel Example import java.awt.*; import javax.swing.*; import javax.swing.border.*; import java.awt.event.*; public class VariousBorders extends JPanel { … Read more

Border Layout in Java

Border Layout in Java

  BorderLayout divides the container into five parts (directions), east, west, north, south, and centre. By using this Layout, we can place AWT components in each part (different locations). BORDER LAYOUT IN JAVA EXAMPLE import java.awt.*; import java.applet.*; public class bordr extends Applet { Button b1,b2,b3,b4,b5; public void init() { b1=new Button(“east”); b1.setBackground(Color.RED); b2=new Button(“west”); … Read more

Java Program Structure

Java Program Structure

Java Program Structure In Java Program Structure, the Java system may contain numerous classes, of which one and only one class characterizes the main technique. Classes contain information members and techniques that work on the information members from the class. Strategies may contain information, sort of revelation, and executable statements. To compose a Java program, … Read more

Java Abstract Window ToolKit(AWT)

Java Abstract Window ToolKit(AWT)

  AWT package is used for components and awt. event package is used for the action performed. If we want to select only one option, we use checkboxes.CheckboxGroup is a set of checkboxes in which we can select only one option(checkbox). The checkboxes that are set in CheckboxGroup are called “radio buttons”. Java Abstract Window … Read more

An Applet Program to Add Two Numbers

An Applet Program to Add Two Numbers

An Applet Program to Add Two Numbers Applets are simple Java programs that run in web browsers. The creation of web pages is related to Java Applets. An applet is an Internet-based Java program that can be included in an HTML page. An applet is a Java class defined in JDK’s java. applet package. Addition … Read more

Animation in Java Applets

Animation in Java Applets

Animation is defined as a rapid(fast/quick) display of text or images. These images or text have to be created in a specific pattern. When they are displayed rapidly, it causes an appearance of movement. Example of animation in Java Applet import javax. swing.*; import java.awt.*; public class animation1 extends JApplet implements Runnable { JLabel labelanimationn; … Read more

History of Java

History of Java

History of Java Java is an object-oriented programming language developed by James Gosling(James A. Gosling, a famous software developer, born on May 19, 1955, in Canada) at Sun Microsystems (Since 1984, he has been associated with Sun Microsystems and developed the Java Programming language in 1991). The language was initially called OAK(named after the OAK … Read more