Monday, November 12, 2012

Java IO (Input /Output)

http://www.freejavaguide.com/corejava-io.pdf

Introduction to Java I/O

Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
Table of Contents
If you're viewing this document online, you can click any of the topics below to link directly to that section.
1. Tutorial tips 2
2. An overview of the java.io package 3
3. java.io class overview 8
4. Sources and sinks 13
5. Files 19
6. Buffering 24
7. Filtering 29
8. Checksumming 33
9. Inflating and deflating 37
10. Data I/O 42
11. Object serialization 46
12. Tokenizing 51
13. Lab 55
14. Wrapup 56
follow the link below for a comprehensive knowledge of Java Input Output

http://www.freejavaguide.com/corejava-io.pdf

Wednesday, October 31, 2012

JDBC - Sample, Example Code

This tutorial provides an example of how to create a simple JDBC application. This will show you how to open a database connection, execute a SQL query, and display the results.
All the steps mentioned in this template example, would be explained in subsequent chapters of this tutorial.

Creating JDBC Application:

There are following six steps involved in building a JDBC application:
  1. Import the packages . Requires that you include the packages containing the JDBC classes needed for database programming. Most often, using import java.sql.* will suffice.
  2. Register the JDBC driver . Requires that you initialize a driver so you can open a communications channel with the database.
  3. Open a connection . Requires using the DriverManager.getConnection() method to create a Connection object, which represents a physical connection with the database.
  4. Execute a query . Requires using an object of type Statement for building and submitting an SQL statement to the database.
  5. Extract data from result set . Requires that you use the appropriate ResultSet.getXXX() method to retrieve the data from the result set.
  6. Clean up the environment . Requires explicitly closing all database resources versus relying on the JVM's garbage collection.

Sample Code:

This sample example can serve as a template when you need to create your own JDBC application in the future.
This sample code has been written based on the environment and database setup done in previous chapter.
Copy and past following example in FirstExample.java, compile and run as follows:

Saturday, October 27, 2012

Surprise guest at JavaOne: Java founder James Gosling

Gosling was a longtime Sun engineer but left Oracle shortly after the company acquired Sun in 2010. Currently working at robotics firm Liquid Robotics, he had been critical of Oracle after he departed from the company. This morning's appearance at the San Francisco event, the premier Java conference of the year, could signal a bit of a hatchet-burying between Gosling and Oracle, which now produces JavaOne in conjunction with the Oracle OpenWorld conference.

Gosling, long considered the father of Java, talked about his company's ocean-probing devices during a brief appearance onstage. He did not mention Oracle during his presentation and instead focused on robotics and networking. Part of his presentation featured a Java Swing application showing the telemetry of four robots. "One of the cool things about Java that most people don't really think about is it's really good at doing AI (artificial intelligence) kinds of things," Gosling said.
Gosling was one of several top Sun engineers who departed from Sun or Oracle in the wake of Oracle's acquisition, with others like XML co-founder Tim Bray leaving as well. Java debuted in 1995.

Monday, October 22, 2012

How to set class path in java



HOW TO SET CLASS PATH IN JAVA
Step 1
Click on start then right click on my computer
Select Propertise

Step 2
Select Advance System settings


Chose Environmental Variable for the popup Dialog
Click New and fill the following



To test it launch Command Prompt and type javac something similar will appear

Monday, October 15, 2012

What a computer Engineer is good at...


Nowadays, there are many users who have become very interested in learning as much as possible about their computers. There are two categories of such users that should be mentioned. One category is represented by users interested in learning more about how they can improve their computers, how they can work better with them by learning something new and how to overcome on their own certain problems that they might encounter while working with their computers.

These users just enjoy doing all sorts of things and activities with the help of their computers and are interested in learning how to do this better or about some of the changes from latest technology that could help them improve their computers when they afford to get access to them. The second category is represented by users who are actually talented in what concerns computer use and are willing to learn as much as possible about all sorts of computers and computer components, related to their functions and to the way in which they influence the performance of computer systems. Some of these users have the necessary talent to become computer hardware engineers if they are able to keep up with all the necessary requirements for this job.

Friday, October 12, 2012

Some Java Programs

A java Program to Add two Numbers

import javax.swing.JOptionPane;

public class Addition

{
public static void main( String args[] )
{

String firstNumber =
JOptionPane.showInputDialog( "Enter first integer" );
String secondNumber =
JOptionPane.showInputDialog( "Enter second integer" );