skip to main | skip to sidebar

Java Programs and Examples with Output

Pages

  • Home
 
  • RSS
  • Twitter
Showing posts with label Java Exception Example. Show all posts
Showing posts with label Java Exception Example. Show all posts
Sunday, September 16, 2012

Create your own Custom Exception

Posted by Admin at 12:59 AM – 0 comments
 

  public class CustomExceptionExample {  
      public static void main(String[] args) {  
          // We demonstrate with a short password  
        try {  
             CustomExceptionExample.checkPass("pass");  
         } catch (InvalidPassException e) {  
             e.printStackTrace();  
         }  
            
         // We demonstrate with no password  
         try {  

            CustomExceptionExample.checkPass(null);  
         } catch (InvalidPassException e) {  
             e.printStackTrace();  
         }  
    
     }  
    
     // Our business method that check password validity and throws InvalidPassException  
     public static void checkPass(String pass) throws InvalidPassException {  
         int minPassLength = 5;  
         try {  

            if (pass.length() < minPassLength)  
                 throw new InvalidPassException("The password provided is too short");  
         } catch (NullPointerException e) {  
            throw new InvalidPassException("No password provided", e);  
         }  
     }  
 }  
 

 // A custom business exception  

class InvalidPassException extends Exception {  
   
     InvalidPassException() {  

   }  
    
     InvalidPassException(String message) {  
        super(message);  
     }  

   
     InvalidPassException(String message, Throwable cause) {  
         super(message, cause);  
     }  
 } 

[ Read More ]
Read more...
Sunday, February 12, 2012

Create a Custom Exception Type

Posted by Admin at 4:02 AM – 0 comments
 
Here is a Java Program to creates a custom exception type.

class MyException extends Exception {
  private int detail;

  MyException(int a) {
    detail = a;
  }

  public String toString() {
    return "MyException[" + detail + "]";
  }
}

class ExceptionDemo {
  static void compute(int a) throws MyException {
    System.out.println("Called compute(" + a + ")");
    if(a > 10)
      throw new MyException(a);
    System.out.println("Normal exit");
  }

  public static void main(String args[]) {
    try {
      compute(1);
      compute(20);
    } catch (MyException e) {
      System.out.println("Caught " + e);
    }
  }
}

Output of Above Java Program
Called compute(1)
Normal exit
Called compute(20)
Caught MyException[20]

[ Read More ]
Read more...
Monday, January 16, 2012

A Java Program that Calls a Method that Throws an Exception of type ArithmeticException

Posted by Admin at 8:49 AM – 0 comments
 
Write a program that calls a method that throws an exception of type ArithmeticException at a random iteration in a for loop. Catch the exception in the method and pass the iteration count when the exception occurred to the calling method by using an object of an exception class you define.

public class IteratedArithmeticException extends Throwable {

  // Default Constructor:
  public IteratedArithmeticException(){}

  // Standard constructor:
  public IteratedArithmeticException(String s, Throwable cause) {
    super(s, cause);                                                   // Call the base constructor.
  }

  public IteratedArithmeticException(int iteration, Throwable cause) {
    super(cause);                                                      // Call the base constructor.

    this.iteration = iteration;                                        // Set the iteration number.

  }

  public int getIteration() {                                          // Get the array index value for the error.
    return iteration;                                                  // Return the iteration number.
  }

  // The default value of -1 can be used to check whether an iteration number was stored
  private int iteration = -1;                                          // Iteration number at which exception occurred.
}

This is the Main to Test the Above Java  IteratedArithmeticException Class which Extends Throwable class. 

public class TestIterated {
  public static void main(String args[]) {
    try {
      loopy();                                                         // Call the method that will throw the exception.
    } catch(IteratedArithmeticException e) {
      System.out.println("Originating exception was: " + e.getCause());
      int iteration = e.getIteration();
      if(iteration < 0) {
      System.out.println("Iteration count not recorded");
      } else {
        System.out.println("Iteration count when exception occurred: " + iteration);
      }
    }
  }

  // This method throws an exception - eventually:
  static void loopy() throws IteratedArithmeticException {
    int iteration = 0;                                                 // Iteration counter.
    int result = 0;                                                    // Stores a result.
    int divisor = 0;                                                   // Random divisor.

    // Loop will continue until an exception is thrown:
    for(iteration = 0 ; ; ++iteration)
      try {
        divisor = (int)(100*Math.random());                            // Generate a random divisor.
        result = 1000/divisor;                                         // If we hit zero - bingo!
      } catch(ArithmeticException e) {
        throw new IteratedArithmeticException(iteration, e);
      }
  }
}



Output of Above Java Program
Originating exception was: java.lang.ArithmeticException: / by zero
Iteration count when exception occurred: 18

[ Read More ]
Read more...

A Java Example to Create your own Exception.

Posted by Admin at 7:11 AM – 0 comments
 
Add an exception class to the last example that differentiates between the index-out-of-bounds error possibilities, rethrows an appropriate object of this exception class in divide(), and handles the exception in main().

This is an Example to define your own Exception we will use this Class in Main Class to Catch Divided by Zero Error.

public class ZeroDivideException extends Exception {
  private int index = -1;                                              // Index of array element causing error

  // Default Constructor
  public ZeroDivideException(){ }

  // Constructor that can be chained
  public ZeroDivideException(String s, Throwable cause) {
    super(s, cause);                                                   // Call the base constructor
  }

  // Contructor recording an index value & can be chained
  public ZeroDivideException(int index, Throwable cause) {
    super(cause);                                                      // Call the base constructor
    this.index = index;                                                // Set the index value
  }

  // Get the array index value for the error
  public int getIndex() {
    return index;                                                      // Return the index value
  }
}

This is an another Example to define your own Exception we will use this Class in Main Class to indentify  'IndexOutOfBounds'  Exception.

public class IdentifyIndexOutOfBoundsException extends Exception {
  // Default Constructor
  public IdentifyIndexOutOfBoundsException(){ }

  // Constructor that can be chained
  public IdentifyIndexOutOfBoundsException(String s, Throwable cause) {
    super(s, cause);                                                   // Call the base constructor
  }

  // Contructor recording an index value & can be chained
  public IdentifyIndexOutOfBoundsException(int index, Throwable cause) {
    super(cause);                                                      // Call the base constructor
    this.index = index;                                                // Set the index value
    gotIndex = true;                                                   // Set index flag
  }

  // Text for when an index value is available
  boolean hasIndex() {
    return gotIndex;
  }
  // Get the array index value for the error
  public int getIndex() {
    return index;                                                      // Return the index value
  }

  private boolean gotIndex = false;                                    // True indicates an index value is available
  private int index = 0;                                               // In index in error
}

This is the main Class to Test Above Classese

public class TryChainedExceptions {

  public static void main(String[] args) {
    int[] x = {10, 5, 0, 3, 12, 0, 6};                                 // Array of  integers
    System.out.print("Values: ");
    for(int xValue : x) {
      System.out.print("  " + xValue);
    }
    System.out.println();

    for(int i = 0 ; i < x.length ; ++i) {
      // This block only throws an exception if method divide() does
      try {
        System.out.println("First try block in main()entered");
        System.out.println("result = " + divide(x,i));
      } catch(ZeroDivideException e) {
        System.out.println("\nZeroDivideException caught in main()");
        int index = e.getIndex();                                      // Get the index for the error
        if(index > 0) {                                                // Verify it is valid and now fix the array
          x[index] = 1;                                                // ...set the divisor to 1...
          x[index + 1] = x[index - 1];                                 // ...and set the result
          e.printStackTrace();
          System.err.println("Zero divisor at x[" + index + "] corrected to " + x[index]);
        }
      } catch(ArithmeticException e) {
        System.out.println("Arithmetic exception caught in main()");
      } catch(IdentifyIndexOutOfBoundsException e) {
        System.out.println("Precise-index-out-of-bounds exception caught in main()");

        Throwable original = e.getCause();
        if(original != null) {
          System.out.println("Original exception was: " + original);
        }

        if(e.hasIndex()){
        System.out.println("Index value out of bounds is: " + e.getIndex());
        }
      }
      System.out.println("Outside first try block in main()");
    }
    System.out.print("Values: ");
    for(int xValue : x) {
      System.out.print("  " + xValue);
    }
    System.out.println();
  }

  public static int divide(int[] array, int index) throws ZeroDivideException, IdentifyIndexOutOfBoundsException {
    try {
      System.out.println("\nFirst try block in divide() entered");
      array[index] = array[index+2]/array[index + 1];
      System.out.println("Code at end of first try block in divide()");
      return array[index + 2];

    } catch(ArithmeticException e) {
      System.out.println("Arithmetic exception caught in divide()");
      ZeroDivideException zde = new ZeroDivideException(index + 1, e);
      System.out.println("Throwing ZeroDivideException");
      throw zde;                                                       // Throw the new exception
    } catch(ArrayIndexOutOfBoundsException e) {
      System.out.println("Index-out-of-bounds index exception caught in divide()");

      // We need to figure which of the three index values caused the problem
      int errorIndex = 0;                                              // Record the index value in error
      if(index < 0 || index >= array.length) {                         // Check for negative index or index greater than array length
        errorIndex = index;
      } else {
        // Two possibilities remain. The error index value was either
        // index+1 or index+2
        errorIndex = index + 1 > array.length ? index + 1 : index + 2;
      }
      throw new IdentifyIndexOutOfBoundsException(errorIndex, e);
    }
    // Because we now throw an exception in the previous catch block,
    // the following code annot be reached so it is commented out.
//    System.out.println("Executing code after try block in divide()");
//    return array[index];
  }
}

Output of Above Java Program
Values: 10 5 0 3 12 0 6
First try block in main()entered

First try block in divide() entered
Code at end of first try block in divide()
result = 0
Outside first try block in main()
First try block in main()entered

First try block in divide() entered
Arithmetic exception caught in divide()
Throwing ZeroDivideException

ZeroDivideException caught in main()
ZeroDivideException: java.lang.ArithmeticException: / by zero
at test.divide(test.java:109)
at test.main(test.java:67)
Caused by: java.lang.ArithmeticException: / by zero
at test.divide(test.java:103)
... 1 more
Zero divisor at x[2] corrected to 1
Outside first try block in main()
First try block in main()entered

First try block in divide() entered
Code at end of first try block in divide()
result = 12
Outside first try block in main()
First try block in main()entered

First try block in divide() entered
Code at end of first try block in divide()
result = 0
Outside first try block in main()
First try block in main()entered

First try block in divide() entered
Arithmetic exception caught in divide()
Throwing ZeroDivideException

ZeroDivideException caught in main()
ZeroDivideException: java.lang.ArithmeticException: / by zero
at test.divide(test.java:109)
at test.main(test.java:67)
Caused by: java.lang.ArithmeticException: / by zero
at test.divide(test.java:103)
... 1 more
Zero divisor at x[5] corrected to 1
Outside first try block in main()
First try block in main()entered

First try block in divide() entered
Index-out-of-bounds index exception caught in divide()
Precise-index-out-of-bounds exception caught in main()
Original exception was: java.lang.ArrayIndexOutOfBoundsException: 7
Index value out of bounds is: 7
Outside first try block in main()
First try block in main()entered

First try block in divide() entered
Index-out-of-bounds index exception caught in divide()
Precise-index-out-of-bounds exception caught in main()
Original exception was: java.lang.ArrayIndexOutOfBoundsException: 8

Index value out of bounds is: 8
Outside first try block in main()
Values: 0 5 2 0 12 1 12

[ Read More ]
Read more...

Java Example that generates General exceptions Like NullPointerException etc.

Posted by Admin at 6:59 AM – 0 comments
 
Write a program that generates exceptions of type NullPointerException, NegativeArraySizeException, and IndexOutOfBoundsException. Record the catching of each exception by displaying the message stored in the exception object and the stack trace record.

public class TestSimple {

  public static void main(String args[]) {
    int result = 0;                                                    // Somewhere to store a result.
    int arraySize = 3;
    int badSize = -1;                                                  // A negative size to generate NegativeArraySizeException.
    int[] array = null;                                                // Define an integer array variable.

    for(int choice = 0; choice<3 ; ++choice)
    try {
      switch(choice) {
        case 0:
         result = array[0];                                            // Generates a NullPointerException.
         break;
        case 1:
         array = new int[badSize];                                     // Generates a NegativeArraySizeException.
         break;
        case 2:
         array = new int[arraySize];
         result = array[arraySize];                                    // Generates an ArrayIndexOutOfBoundsException.
         break;
      }
    } catch(NullPointerException e) {                                  // Catch the NullPointerException:
      System.out.println("\nNullPointerException Exception caught. " +
                         "Message in NullPointerException is:\n" +
                         "\n" + e + "\n");
      System.out.println("The contents of the stack trace are:\n");
      e.printStackTrace();
    } catch(NegativeArraySizeException e) {                            // Catch the NegativeArraySizeException:
      System.out.println("\nNegativeArraySizeException Exception caught. " +
                         "Message in NegativeArraySizeException is:\n" +
                         "\n" + e + "\n");
      System.out.println("The contents of the stack trace are:\n");
      e.printStackTrace();
    } catch(ArrayIndexOutOfBoundsException e) {                        // Catch the ArrayIndexOutOfBoundsException:
      System.out.println("\nArrayIndexOutOfBoundsException Exception caught. " +
                         "Message in ArrayIndexOutOfBoundsException is:\n" +
                         "\n" + e + "\n");
      System.out.println("The contents of the stack trace are:\n");
      e.printStackTrace();
    }
  }
}


Output of Above Java Program
NullPointerException Exception caught. Message in NullPointerException is:

java.lang.NullPointerException

The contents of the stack trace are:

java.lang.NullPointerException
at  TestSimple.main( TestSimple.java:13)

NegativeArraySizeException Exception caught. Message in NegativeArraySizeException is:

java.lang.NegativeArraySizeException

The contents of the stack trace are:

java.lang.NegativeArraySizeException
at  TestSimple.main( TestSimple.java:16)

ArrayIndexOutOfBoundsException Exception caught. Message in ArrayIndexOutOfBoundsException is:

java.lang.ArrayIndexOutOfBoundsException: 3

The contents of the stack trace are:

java.lang.ArrayIndexOutOfBoundsException: 3
at  TestSimple.main( TestSimple.java:20)

[ Read More ]
Read more...
Older Posts
Subscribe to: Posts ( Atom )

List of Java Programs

  • Java Program to check Greater between the Two Number
  • Java Program to find that given number is Palindrome or not
  • Java Program to Demonstrate the Use of Pre and Post Operator
  • Java Program to Reverse the Given Number
  • Java Program to Print Number in the Given Data Type
  • Program to Demonstrate Skipping using Continue
  • Program to find whether entered character is a vowel or Consonant
  • Java Program to Calculate the Sum of Digits of Given Number
  • How to swap two numbers using only two variables
  • Checking the Given Number is Armstrong or Not
  • Average an Array of Values
  • Display ASCII Code Instead of Character
  • Comparison of Two Variable using If
  • Printing Table In java using While Loop
  • Generate Random Number Using Math.Random Function
  • To Find roots of Quadratic Equation
  • Performing Arithmetic Opration on Two Variable
  • Concatenation of Two String in Java
  • Command Line Argument in JAVA
  • Java Hello World Program
  • Calculate Circle Perimeter | Java Program
  • Calculate the Area of Circle | Java Program
  • To Find Whether Given Year is a Leap Year or not
  • Popular
  • Recent
  • Archives

Total Pageviews

Sparkline

Followers

Popular Posts of This Week

  • Implementation of a basic generic tree, with labels of type T - Data Structure
    // This implements a basic generic tree, with labels of type T, // pointer to the parent node, and a singly linked list of children nodes...
  • Java program to create a Binary Heap and Perform various operation
    A binary heap (min-heap) is a complete binary tree with elements from a partially ordered set, such that the element at every node is less ...
  • Sort an Integer array with Bucket Sort
    Here is a java program to Sort an Integer array with Bucket Sort class BucketSort { public int[] bucketSort(int[] array) { /...
  • Merge-Sort Algorithm implementation in JAVA
    Merge-Sort Function void MergeSort(int low, int high) // a[low : high] is a global array to be sorted. // Small(P) is true if there...
  • To Sort an Interger Array using Shell Sort
    To Sort an Interger Array using Shell Sort class ShellSort { public static int[] shellSort(int[] array) { int N = array.length; ...
  • Create an Adjacency matrix Graph and perform Add and Remove operation
    import java.util.ArrayList; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; import...
  • Use a StreamTokenizer object to parse a string separated by commas
     Use a StreamTokenizer object to parse a string entered from the keyboard containing a series of data items separated by commas and output ...
  • Singly linked list with header - Data Structure
    class OrderedList { private int value; private OrderedList next; // Note: No setValue() method or setNext() methods are provide...
  • Find File in a Zip File Example
    Find File in a Zip File Example. This Java example shows how to find a particular file in a zip file using ZipFile ...
  • Stack implemented as array - Data Structure
    // Stack implemented as array public class ArrayStack<T> { private T[] stack; private int numElements = 0; // points to s...
Powered by Blogger.

Archives

  • ▼  2014 ( 4 )
    • ▼  August ( 4 )
      • Java program to create a Binary Heap and Perform v...
      • Create an Adjacency matrix Graph and perform Add a...
      • To Sort an Interger Array using Shell Sort
      • Sort an Integer array with Bucket Sort
  • ►  2013 ( 6 )
    • ►  August ( 1 )
    • ►  April ( 5 )
  • ►  2012 ( 673 )
    • ►  November ( 9 )
    • ►  October ( 223 )
    • ►  September ( 272 )
    • ►  August ( 2 )
    • ►  June ( 1 )
    • ►  February ( 67 )
    • ►  January ( 99 )
 

Our Blogs

  • Linux Tutorial
  • C Programming Tutorial

Labels

  • Agile Methodology ( 1 )
  • Algorithm ( 3 )
  • AntiSamy ( 1 )
  • Arithmetic Operation ( 1 )
  • Array Example ( 9 )
  • ArrayList Examples ( 11 )
  • Average an Array of Values ( 1 )
  • Barcode Example ( 1 )
  • Basic Java Programs ( 34 )
  • Bing API Example ( 2 )
  • BitSet Example ( 1 )
  • Boolean Example ( 1 )
  • Bouncy Castle API ( 1 )
  • Break Statement ( 2 )
  • BufferedReader Example ( 2 )
  • Calendar Example ( 1 )
  • Chart Generation Example ( 1 )
  • Command Line Argument ( 1 )
  • Comparator Example ( 1 )
  • Concatenation of String ( 1 )
  • Continue Statement ( 1 )
  • Control Structure ( 1 )
  • Copy File Example ( 1 )
  • CRC Example ( 1 )
  • CSV Example ( 6 )
  • Data Structure ( 5 )
  • Date Example ( 2 )
  • Directory Example ( 1 )
  • Do - While Loop Example ( 1 )
  • Domino Database ( 1 )
  • Email Example ( 8 )
  • Encryption Example ( 3 )
  • Excel Example ( 15 )
  • Factorial Example ( 1 )
  • File Upload Example ( 1 )
  • Find Roots of Quadratic Equation ( 1 )
  • FTP Example ( 2 )
  • Graph Examples ( 1 )
  • Greater between Two Numbers ( 1 )
  • GSON Library ( 1 )
  • HashMap Example ( 1 )
  • HashSet Example ( 1 )
  • Hello World Program ( 1 )
  • If Condition ( 2 )
  • Inner Class Example ( 1 )
  • iText Example ( 3 )
  • JAR File ( 1 )
  • JAVA Applet ( 1 )
  • Java Applications ( 1 )
  • Java AWT Example ( 9 )
  • Java Certification ( 1 )
  • Java Class Examples ( 15 )
  • Java Collection Example ( 1 )
  • Java Command Example ( 4 )
  • Java Constructor Examples ( 1 )
  • Java Currency Example ( 1 )
  • Java Database Example ( 3 )
  • Java Date and Time Example ( 3 )
  • Java DateFormat Example ( 3 )
  • Java Examples ( 2 )
  • Java Exception Example ( 5 )
  • Java File Example ( 22 )
  • Java GUI Example ( 1 )
  • Java Image Examle ( 3 )
  • Java Inheritance Example ( 3 )
  • Java Input Output Example ( 1 )
  • Java IO Example ( 3 )
  • Java Jar Example ( 1 )
  • Java JSON Example ( 3 )
  • Java Mail Examples ( 4 )
  • Java Map Example ( 5 )
  • Java MapReduce Example ( 2 )
  • Java MultiThreading Example ( 7 )
  • Java Network Example ( 9 )
  • Java Package ( 1 )
  • Java Programs ( 1 )
  • Java RMI ( 1 )
  • Java Robot Class Examples ( 2 )
  • Java Runtime Example ( 1 )
  • Java Swing Example ( 9 )
  • Java Util Example ( 1 )
  • Java Vector Example ( 4 )
  • Java Voice Example ( 1 )
  • Java Webservice Example ( 1 )
  • Java XML Example ( 3 )
  • Java Zip Class Examples ( 2 )
  • JDBC ( 9 )
  • JDK Version Comparison ( 1 )
  • JFrame Example ( 3 )
  • JOptionPane Dialog Example ( 1 )
  • JPanel Example ( 1 )
  • JSP Example ( 2 )
  • JSTL Example ( 1 )
  • jUnit Example ( 2 )
  • LinkedList Example ( 2 )
  • List Example ( 1 )
  • Long Variable ( 1 )
  • Lottery Nubmer ( 1 )
  • MD5 Hashing Example ( 3 )
  • Memory Management Example ( 1 )
  • Method Override ( 1 )
  • MIDI Sound ( 8 )
  • Module Operator Example ( 2 )
  • Multiplication Table ( 1 )
  • Observer Interface Example ( 1 )
  • Operator Example ( 5 )
  • Pagination ( 1 )
  • Palindrome Number ( 1 )
  • Pass By Reference Example ( 1 )
  • Pass By Value Example ( 1 )
  • PDF File Example ( 3 )
  • PDF Generation Example ( 4 )
  • Pre and Post Operator ( 2 )
  • Prime Number ( 3 )
  • Progress Bar Example ( 1 )
  • Property List Example ( 2 )
  • Random Function ( 7 )
  • Recursion Example ( 2 )
  • Regex Example ( 2 )
  • Remote Host Example ( 2 )
  • Robot Class ( 4 )
  • Searching Example ( 3 )
  • Slideshow ( 1 )
  • Sorting Example ( 7 )
  • SpringLayout Example ( 1 )
  • Stack Example ( 4 )
  • Static Variable ( 1 )
  • StreamTokenizer Example ( 2 )
  • String Example ( 19 )
  • Struts2 Example ( 1 )
  • Sum of Digits ( 1 )
  • Swap Two Numbers ( 1 )
  • Switch Case ( 3 )
  • Tapestry Components ( 1 )
  • Thumbnail Example ( 2 )
  • TimerTask Example ( 2 )
  • To Calculate Volume ( 1 )
  • To Check Armstrong Number ( 1 )
  • Tree Example ( 1 )
  • TreeMap Example ( 1 )
  • TreeSet Example ( 1 )
  • Two Dimensional Array Example ( 1 )
  • UUID ( 1 )
  • Validation Example ( 2 )
  • Variable Casting ( 1 )
  • While Loop ( 1 )
  • XML Parsing ( 7 )
  • XSS Attacks ( 1 )
  • Zip File ( 15 )

Popular Posts

  • Java program to create a Binary Heap and Perform various operation
    A binary heap (min-heap) is a complete binary tree with elements from a partially ordered set, such that the element at every node is less ...
  • Creating Dynamic Macro Enabled Excel by Java
    We can create a dynamic macro enabled excel by java: We need to create a excel sheet template with macro on server. we can copy the...
  • Implementation of a basic generic tree, with labels of type T - Data Structure
    // This implements a basic generic tree, with labels of type T, // pointer to the parent node, and a singly linked list of children nodes...
  • To Sort an Interger Array using Shell Sort
    To Sort an Interger Array using Shell Sort class ShellSort { public static int[] shellSort(int[] array) { int N = array.length; ...
  • Create an Adjacency matrix Graph and perform Add and Remove operation
    import java.util.ArrayList; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; import...
  • Sort an Integer array with Bucket Sort
    Here is a java program to Sort an Integer array with Bucket Sort class BucketSort { public int[] bucketSort(int[] array) { /...
  • Merge-Sort Algorithm implementation in JAVA
    Merge-Sort Function void MergeSort(int low, int high) // a[low : high] is a global array to be sorted. // Small(P) is true if there...
  • Stack implemented as array - Data Structure
    // Stack implemented as array public class ArrayStack<T> { private T[] stack; private int numElements = 0; // points to s...
  • Printing Table In java using While Loop
    Here is a Java Program to Print the Table public class Table { public static void main(String[] args) { int no = Integer.p...
  • Java Class to Calculate the Volume of Box
    Here is a Java Class to Calculate the Volume of Box. class Box { double width; double height; double depth; // This is the con...
 
 
© 2011 Java Programs and Examples with Output | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger