home / developersection / category
The exceptions we have seen so far are synchronous in nature, in the sense that we know the point in the program where they occur and when they happen, and we process them immediately in the same thread.
Our Point class declared here contains only fields. Now, we will add a method to the Point class which will help us understand the method declaration and calling syntax.
IntroductionOne of the major benefits of object-oriented programming is code reuse. Programmers develop lot of code over time. If this code can be reu
Looking at Murphy’s Law, “If anything simply cannot go wrong, it will anyway,” we know that we should always prepare ourself for the worst-case scenario.
We can easily catch and handle errors in our programs so that they do not terminate abnormally. When a program terminates abnormally, typically it dum
In my previous post, we have learnt how we can handle multiple exceptions in our code by providing multiple numbers of catch block specific to a particular exception.
In the program example discussed in the previous post (multiple catch blocks section), we made a URL connection to read the home page contents from the user-specified URL.
When a running Java application fails, it creates an exception object encapsulating the error condition and throws it back to the running code. The ex
A local class without a name is called an anonymous class. If we need only a single instance of a local class, we will create an anonymous class. Typically, a local class has a name and thus a declaration.
A non-static class defined within a class is called a member class of the enclosing class. A member class is commonly used as a helper class to the enclosing class.
uppose we are required to create an application that generates a random list of odd numbers. The list itself should consist of a random number of entr
Introduction As the name suggests, we can embed a class declaration within another class. This gives us the power to hide our classes within an outer