Java Programming Tutorials

Java Programming Tutorials And Articles
  Title / Author Replies
Views
A thread can be created in Java programs in two ways – by extending Thread class and by implementing Runnable interface. In case, where the class extends a Tread class, it must override run() method of the Thread class. The program may override the other methods also. If the program uses Runnable...
0
25,220
Introduction JavaServer Faces solves many of the historical problems of Java Web development by providing a clean implementation of the Model-View-Controller design pattern while providing a productive, component-centric development without sacrificing development power and flexibility....
0
4,417
Introduction Java environment has been built around the multithreading model. In fact all Java class libraries have been designed keeping multithreading in mind. If a thread goes off to sleep for some time, the rest of the program does not get affected by this. Similarly, an animation loop can...
0
18,138
The exception handling mechanism is a cleaner way to impose check upon the conditions which may lead to errors. But you should not be carried away by it and start using exception handling anywhere and everywhere you want. Exceptions must be carefully planned and implemented. The following cases...
0
3,802
Java defines several built-in classes for exception handling. All these classes are a part of the java.lang package which is automatically imported. That is why, while throwing an exception you did not specifically include any package for exception classes. Apart from the built-in exception...
0
23,312
Just like the multiple catch blocks, we can also have multiple try blocks. These try blocks may be written independently or we can nest the try blocks within each other, i.e., keep one try-catch block within another try-block. The program structure for nested try statement is: try { //...
0
14,361
Introduction The code bound by the try block need not always throw a single exception. If in a try block multiple and varied exceptions are thrown, then you can place multiple catch blocks for the same try block in order to handle all those exceptions. When an exception is thrown it traverses...
0
22,789
The finally clause is written with the try-catch statement. It is guarenteed to be executed after a catch block or before the method quits. try { // statements } catch (<exception> obj) { // statements }
0
2,685
You have seen that an exception is thrown either implicitly in the try block and there is a catch block ready to handle it. But, there are methods, which throw the exception, but do not catch it within the method body. In this case the method which is throwing the exception must use a throws clause...
0
15,496
Before you can catch an exception, some code somewhere must throw one. Any code can throw an exception: your code, code from a package written by someone else such as the packages that come with the Java platform, or the Java runtime environment. Regardless of what throws the exception, it's always...
0
26,137
Introduction The code which is expected to generate the exception must be enclosed in the try and catch block. The very basic form of the exception-handling block is as following: try { //code which is expected to generate the exception } catch (<ExceptionTypeClass> object) {...
0
8,627
Exception is an abnormal condition that arises in the program during execution. When such a condition arises in the program, an appropriate code is written so that it can be handled. It is very much similar to the error codes returned by a subroutine in the C language. Whatever value the function...
0
3,500
JNode, a "Java New OS Design Effort" is an open source all java operating system. It is a modern OS with support for modern hardware devices intended to be simple to use, install & maintain on personal devices such as desktops, tablet pcs and handhelds. JNode has started out many years ago as...
7
4,166
Earlier in client- server computing, each application had its own client program and it worked as a user interface and need to be installed on each user's personal computer. In web applications we mostly use HTML/XHTML which is mostly supported by all the browsers and web page is displayed to the...
0
3,607
The JavaMail API (http://java.sun.com/products/javamail/) is a messaging framework intended to build platform-independent applications that use e-mail messaging. It is included in the J2EE platform and is available as an optional package in J2SE. The API's main purpose is not for transporting,...
0
30,803
The classical input/output (I/O) library in Java contains classes that support I/O handling of streams with compressed data. You can easily compress and decompress any text or binary data to or from any I/O stream using either a file or any other stream (e.g., a servlet output stream). In this...
0
5,346
Introduction Buffers can be very useful in Java since they speed up I/O operations considerably. Basically a buffer is a space allocated in memory for Bytes, Chars, and other data types to be stored. Buffers are really useful while writing Client/ Server applications. Creating a Buffer A...
4
25,759
Introduction Assertion facility is added in J2SE 1.4. In order to support this facility J2SE 1.4 added the keyword assert to the language, and AssertionError class. An assertion checks a boolean-typed expression that must be true during program runtime execution. The assertion facility can be...
4
17,765
How do I instantiate a bean whose constructor accepts parameters using the useBean tag? Replacing Characters in a String? Searching a String? Connecting to a Database and Strings Handling? What is a transient variable?
1
20,391
When many items of data of the same class or type have to be stored, it is more efficient to use an array than separate variables or objects. For example, if the temperature on each day of the (non-leap) year had to be stored, rather than set up tempjan1, tempjan2... tempdec31 (365 variables)...
2
14,032