User Defined Exception in Java

The built-in exceptions provided by the Java platform are used to handle errors occurring in the program. But , sometimes the programmer wants to create his own application specific exceptions. User defined exception can be created simply by defining a subclass of Exception class and using the throw keyword.

Addition of Two Numbers Using Applet

To build an applet, first of all we need to create an applet code(.java file). After successful compilation, its corresponding .class file is created. Then a web page also known as HTML document is to be developed. Once the HTML document is created, the applet is to be inserted in it. Finally the resultant HTML document will be executed to produce the desired output.

Recursion in Java

Java support Recursion function. Recursion is the attribute that allows a method to callitself. A method that calls itself is said to be recusive. The best example of recursion is the computation of the factorial(1*2*3*4*5) of a number. The factorial of a number n(any last number) is the product(*) of all the whole numbers between 1 and n.

Scope and Lifetime of Variables in Java

So far, all of the variables used have been declared at the start of the main(). However, Java allows variables to be declared within any block. A block is begun with an opening braces and ended by a closing braces. A block defines a scope.

Input Dialog Box in Java Swing

An Input Dialog Box is used to accept data from the user. It appears with a component like TextField, ComboBox or List which lets the user to input the data. It is created by using the static method showInputDialog() of JOptionPane.

How to Use CardLayout in Java

The CardLayout manager is used to manage a large number of components. It organizes the components in layers which are arranged like a deck of cards sharing the same display area such only one of them is visible at a time. In order to use card layout, it is required to create an object of type JPanel that will hold the cards.

C ++ Program to count vowels in a String

String is one of the special type of array that is array of characters. The term “String” generally means an ordered sequence of characters. In most programming language such string are enclosed in either single or double quotes.

Switch Statement in C++

Switch case is a multi way decision maker, that test whether an expression matches one of the number of values. In switch statement we use case, default, break reserved keywords.

Paint method in Java

Paint method allows you to draw a text message ,draw an image,draw a rectangle,oval etc. You can set the color of the text and the diagram(oval,rect,fillrect).

Timer and TimerTask in Java Swing

We use java.util.Timer for threads.This class provides schedule tasks for future execution in a background thread. We use java.util.TimerTask to set scheduled for one-time or repeated execution by a Timer.

Page 9 of 30

About Us

Rekha SetiaRekha Setia is a passionate blogger of Extra Computer Notes. if you have any ideas or any request me @