Pages

Thursday, February 21, 2013

Printing output to the browser using Servlets


In general the output is printed to the Apache Command Line but if we want to print the output to the Web Browser we will use the PrintWriter class declared in the java.io.* package.

Steps to deploy a project developed using Servlets



Following are the steps to deploy a project in the server. We use Apache Tomcat and the folder to place the project folder is usually C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps

Servlet Interface, Methods and Important Notes about Servlets


Servlet is an interface available in two packages javax.servlet.*; and javax.servlet.http;
Servlets are generally implemented using 3 ways:

Writing the Deployment Descriptor i.e., web.xml for Servlets


Web.xml is the deployment descriptor i.e., it describes all the classes being used in the project. It is the first file checked by the server and if not present then the output is not obtained.

Project Hierarchy when using Servlets



As we are dealing with projects in Servlets we follow a standard hierarchy to make the server understands where to go and search when we work on the Servlets.

Applications needed to Work with Servlets

A servlet is used build Web Applications in simple words. In other words Servlet is a Java program executed on the server instead of a command line interface.

Friday, February 15, 2013

Increment and Decrement Operators in Java



Operators are of various types in Java and of them increment and decrement operators are special ones with much more complex functionality with pre and post types. In this post, you will understand various ways on how these operators perform depending on the usage.

Thursday, February 14, 2013

Hash Code of Objects in Java


JVM allocated memory for the objects when they are initialized in the main() method.
HashCode is a unique identity given by the JVM to each and every object which is not normally used.

Constant and final keyword usage in Java


Constants are variables which once set cannot be changed i.e., once a value is set then it cannot be altered whatsoever. Local variables inside methods can also be declared as final. 

5 Steps to Connect & Talk to the Database using Java

Basically to connect and interact with a database we have 5 simple steps to be followed which are all single lines of code from the interfaces available in the java.sql.* package.

Sunday, February 10, 2013

Steps to Install Oracle SQL Database

In this post I will write the steps required to connect to an Oracle database using JDBC in Java Programming. There are 5 simple steps and we will the use the interfaces as discussed in the previous post here.

Saturday, February 9, 2013

Garbage Collector in Java - How it works!

Dynamic allocation of objects is possible in java using the new keyword. Once an object is created it is allocated with memory and this memory is alive until there are references being used by the object in the program. 

Database Connectivity using Java & Packages in Java


Database connectivity and handling the contents of the database are done using the Drivers provided by various vendors. Databases and Java language are unknown to each other and hence there is a requirement of a common mediator between java language and the database which is generally called a Driver.

Wednesday, February 6, 2013

Oops! - OOPS Concepts in Simple Words

Java is purely object oriented programming language which means everything we write in Java is an Object and Class. We have various OOPS concepts but to understand and follow Java we just have to learn 4 of these OOPS concepts.

Tuesday, February 5, 2013

Knowing static Keyword in Java

static keyword in Java is used basically in 3 different scenarios of which include Static Methods, Static Variables and Static Blocks of Code. 

Sunday, February 3, 2013

Basics of Interfaces in Java

To understand Interfaces, I'll start with a simple example to make it easier to grab the concept. Consider an automobiles (Computer controlled robotic cars) to be built for transporting passengers from place to place in the future. Manufacturers write the Java code for operating the automobile i.e., start, stop, turn, accelerate, etc., and electronic instrument managers make systems which receive the GPS information, transmission of traffic conditions which will be used to control the car.

Abstract Classes & Abstract Methods With Examples


Abstract classes are defined using "abstract" keyword. They contain both abstract methods and concrete methods. Abstract methods do not have any implementation. Any method which has a body is known as a concrete method. An abstract class can have constructors.

Saturday, February 2, 2013

Constructors in Java


What is a Constructor and Applications ?
A special method in Java which is used to initialize the newly created objects. A constructor is called immediately after the memory is allotted to the object. 
Constructors are methods with same name as a class name and do not have a return type. If constructors have a return type then they are no different than general methods, hence they don't have a return type like "void", "int" etc.

Variable Manipulation (Type Casting) in Java


Variable Manipulation (Type Casting) in Java
Converting one data type into another is called as TypeCasting. Based on conversion it is divided into two types namely "Widening" and "Narrowing"

Understading Basement of Java in Simple Words


Java is purely object oriented language i.e., everything in Java is written in a Class and accessed using a Object. Java is platform independent as the .class file generated for every .java is run on any system according to the host configuration by the JVM.