Posts Tagged ‘Beginning Java’

Beginning Java Programming: The Object-Oriented Approach Chapter 6 Finally Keyword and Try-Catch

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example demonstrates how to use the finally keyword with try-catch blocks. The code in the finally block will always be executed when the try-catch block exits. Click “Run” to run the example in your browser or edit the code […]

Tags:

Beginning Java Programming: The Object-Oriented Approach Chapter 6 Catching Exceptions Using Throwable interface

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example demonstrates how to catch any type of exception by using the Throwable interface. Click “Run” to run the example in your browser or edit the code and then click “Run” to run it with your changes. You can […]

Tags:

Beginning Java Programming: The Object-Oriented Approach Chapter Catching 2 Exceptions with 1 Try

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example demonstrates how to catch two types of exceptions using only one try block. The program catches exceptions of types ArithmeticException and NullPointerException while using a single try block. Click “Run” to run the example in your browser or […]

Tags:

Beginning Java Programming: The Object-Oriented Approach Chapter 6 Catching 2 Exceptions

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example demonstrates how to catch two types of exception using a single line of code. The program catches exceptions of types ArithmeticException or NullPointerException using the code on line 15. Click “Run” to run the example in your browser […]

Tags:

Beginning Java Programming: The Object-Oriented Approach Chapter 6 Catching a Thrown Exception

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example demonstrates how to catch a thrown exception. The program throws an exception of the type ArithmeticException which is then caught on line 15. Click “Run” to run the example in your browser or edit the code and then […]

Tags:

Beginning Java Programming: The Object-Oriented Approach Chapter 6 matching double format

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example changes the DecimalFormat class to format to double and 2 decimal places. Click “Run” to run the example in your browser or edit the code and then click “Run” to run it with your changes. You can download […]

Tags:

Beginning Java Programming: The Object-Oriented Approach Chapter 6 runtime exception

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example demonstrates a “Divide by Zero” runtime exception. The exception is thrown on line 11 because the value of yearsInRetirement is set to zero. Click “Run” to run the example in your browser then edit the code to fix […]

Tags:

Beginning Java Programming: The Object-Oriented Approach Chapter 6 Compiler Errors

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example demonstrates compiler errors. The program has atleast 6 compiler errors. Can you debug and fix them? Click “Run” to run the example in your browser and see the errors then edit the code and click “Run” to run […]

Tags:

Beginning Java Programming: The Object-Oriented Approach Chapter 6 JUnit

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 6. This example demonstrates how to use JUnit for writing your unit tests. The program is a basic test harness for checking conversions made between meters, feet, inches and centimeters. Click “View Project” to run the example in your browser or […]

Tags:

Beginning Java Programming: The Object-Oriented Approach Chapter 5 Addition Do-While Loop

This is the live code sandbox for Beginning Java Programming: The Object-Oriented Approach Chapter 5. This example demonstrates a short way of doing a sales calculation by using a do-while loop to add the sales of a product in each month of 2014. Click “View Project” to run the example in your browser or edit […]

Tags: