<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JSP, Tomcat, JDBC, Projects, Example, Program &#187; Java</title>
	<atom:link href="http://www.easywayserver.com/blog/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.easywayserver.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 04 Jun 2011 05:32:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Java &#8211; Abstract Classes and Methods</title>
		<link>http://www.easywayserver.com/blog/java-abstract-classes-and-methods/</link>
		<comments>http://www.easywayserver.com/blog/java-abstract-classes-and-methods/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 05:32:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=775</guid>
		<description><![CDATA[Java Abstract Method
An Abstract method in java is a method prototype without any implementation.  Its implementation is provided by the subclass of the java class in which it is declared.  To create an java abstract method, simply specify the modifier abstract followed by the method declaration and replace the method body by a [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-abstract-classes-and-methods%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-abstract-classes-and-methods%2F" height="61" width="51" /></a></div><h2>Java Abstract Method</h2>
<p>An Abstract method in java is a method prototype without any implementation.  Its implementation is provided by the subclass of the java class in which it is declared.  To create an java abstract method, simply specify the modifier abstract followed by the method declaration and replace the method body by a semi-colon.</p>
<p>Syntax of java abstract method:</p>
<p>abstract datatype function name();</p>
<p><strong>Example:</strong></p>
<p>abstract double area();</p>
<p>NOTE:</p>
<p>1. Method must always be defined in a subclass.</p>
<p>2. Method declared with final keyword, can not be redefined in subclass.</p>
<h2>Java Abstract Class</h2>
<p>The class that contains atleast one abstract method must be declared abstract such a class known as java abstract class.  Using abstract classes, we must specify the following conditions:</p>
<p>1. We can not use abstract classes to declare instance object directly.</p>
<p>2. Java Abstract method of abstract class must defined in its sub classes.</p>
<p>3. We can not declare Abstract Constructor.</p>
<p>When we are extending existing classes, we have a choice to redefine the method of super class.  A super class has common features that are shared by sub class.  In some cases, we find that super class cannot have any object and such of classes are called Abstract classes.</p>
<p>Java Abstract classes usually contain abstract method.  Abstract classes are generally used to provide common interface sub classes.  We know that a super class is more simple than its sub class.</p>
<p>
<strong>Example:</strong><br />
</p>
<pre class="brush: java">
	abstract class A
	{
		abstract void call();
	}

	class B extends A
	{
		void call() {

		}
	}

	class absexampleprog
	{
		public static void main(String a[])
		{
			B ob=new B();
			ob.call();
		}
	}
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/interface-program-in-java/" rel="bookmark" class="crp_title">Interface Program in Java</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-interface-with-example/" rel="bookmark" class="crp_title">Java Interface Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/learn-java-programming/" rel="bookmark" class="crp_title">Learn Java Programming</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-class-example/" rel="bookmark" class="crp_title">Java Class example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-environment/" rel="bookmark" class="crp_title">Java Environment</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-inheritance/" rel="bookmark" class="crp_title">Java Inheritance</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/java-abstract-classes-and-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Simple Inheritance</title>
		<link>http://www.easywayserver.com/blog/java-simple-inheritance/</link>
		<comments>http://www.easywayserver.com/blog/java-simple-inheritance/#comments</comments>
		<pubDate>Tue, 17 May 2011 14:14:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=766</guid>
		<description><![CDATA[By: Jatin Chawla
Simple Inheritance means heredity from one generation to second; A child inherit many good and bad qualities from his parents such as some identification marks, diseases etc.  If we talk about Java Simple Inheritance, there are only one base and derived class.  We can define this as a pictorial representation as:
We [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-simple-inheritance%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-simple-inheritance%2F" height="61" width="51" /></a></div><p>By: Jatin Chawla</p>
<p>Simple Inheritance means heredity from one generation to second; A child inherit many good and bad qualities from his parents such as some identification marks, diseases etc.  If we talk about Java Simple Inheritance, there are only one base and derived class.  We can define this as a pictorial representation as:</p>
<p>We show a picture as an example of Simple Inheritance</p>
<pre class="brush: java">
public class square {

	int length, breadth;
	public void get(int x, int y)
	{
		length=x;
		breadth=y;
	}
	int area()
	{
		return(length*breadth);
	}

}
</pre>
<p>&nbsp;</p>
<pre class="brush: java">
public class cube extends square
{
	int height;
	public void getdata(int x,int y,int z)
	{
		get(x,y);
		height=z;
	}
	int volume()
	{
		return(length*breadth*height);
	}

}
</pre>
<pre class="brush: java">
public class RunInheritance {
	public static void main(String a[])
	{
		cube C=new cube();
		C.getdata(10,20,30);

		int b1=C.area();
		System.out.println("Area of Square: "+b1);

		int b2=C.volume();
		System.out.println("Volume of Cube: "+b2);
	}

}
</pre>
<p>Output</p>
<p><em>Area of Square: 200<br />
Volume of Cube: 6000</em></p>
<p>In above example, it is defined that every square has a fixed area and volume; We create two classes i.e. Square and Cube, In first class we define the area of square and in next / derived class we defined the volume of Cube.  We can access the area and volume of the Square or Cube by calling the function through Cube class object.  As we know that A single Cube has 6 faces of squares that have equal length, breadth and height; In our example, It is shown that A cube can carry 6 square and then it formed in &#8220;Cube&#8221;.  We have just used the functionality of super class (Square Class) in Sub Class (Cube Class).</p>
<p>
There are many more examples of Simple Inheritance.</p>
<ul style="font-size:10px">
<li>1. A student is always a person i.e. A student will contain all attributes and behaviors / features of person class.</li>
<li>2. A car is counted in four wheelers so A car will contain about all general features of Four wheelers.</li>
<li>3. A multimedia mobile is considered as a simple mobile i.e. a multimedia mobile will adopt all features of General mobile.</li>
</ul>
<p></p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-inheritance/" rel="bookmark" class="crp_title">Java Inheritance</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-math-cbrt-example-math-cbrt-program-math-cube-root/" rel="bookmark" class="crp_title">Java &#8211; Math cbrt Example, Math cbrt Program, Math cube root</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-oop-concept/" rel="bookmark" class="crp_title">Java OOP Concept</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-class-examples/" rel="bookmark" class="crp_title">Java Class Examples</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-math-sqrt-example-math-sqrt-function/" rel="bookmark" class="crp_title">Java &#8211; Math sqrt() Example, Math sqrt() Function</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-abstract-classes-and-methods/" rel="bookmark" class="crp_title">Java &#8211; Abstract Classes and Methods</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/java-simple-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Control Statements</title>
		<link>http://www.easywayserver.com/blog/java-control-statements/</link>
		<comments>http://www.easywayserver.com/blog/java-control-statements/#comments</comments>
		<pubDate>Tue, 17 May 2011 07:57:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=761</guid>
		<description><![CDATA[By: Pankaj Yadav
Java Control statements in a programming language are very useful as they allow a programmer to change the flow of program execution i.e. altering the normal program flow to jump directly on some statement(s) or to skip a statement(s). In Java control statements are divided into following 3 categories:
Selection/Decision making Statements
Using these statements, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-control-statements%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-control-statements%2F" height="61" width="51" /></a></div><p>By: Pankaj Yadav</p>
<p>Java Control statements in a programming language are very useful as they allow a programmer to change the flow of program execution i.e. altering the normal program flow to jump directly on some statement(s) or to skip a statement(s). In Java control statements are divided into following 3 categories:</p>
<p><strong>Selection/Decision making Statements</strong></p>
<p>Using these statements, a piece of code would be executed only if a certain condition(s) is true. These are of 3 types:</p>
<p><strong>1. if</strong></p>
<p>Statement(s) between the set of curly braces ‘{ }’ will be executed only if the condition(s), between the set of brackets ‘( )’ after ‘if’ keyword, is/are true.</p>
<p>Syntax:
<pre  class="brush: java">
if (Condition) {
	// statements;
}
</pre>
<p><strong>2. if-else</strong></p>
<p>If the condition(s) between the brackets ‘( )’ after the ‘if’ keyword is/are true then the statement(s) between the immediately following set of curly braces ‘{ }’ will be executed else the statement(s) under, the set of curly braces after the ‘else’ keyword will be executed.</p>
<p>Syntax:</p>
<pre  class="brush: java">
if (condition) {
	// statements;
} else {
	// statements;
}
</pre>
<p><strong>3. switch</strong></p>
<p>When there is a long list of cases &#038; conditions, then if/if-else is not good choice as the code would become complicated. </p>
<p>Syntax:</p>
<pre  class="brush: java">

		switch (expression)
 		{
			case value1:
			//statement;
			break;
			case value2:
			//statement;
			break;
			default:
			 //statement;
		}
</pre>
<p>In the above piece of code, the user’s choice (add/sub/mul) will be stored in variable ‘ch’. The moment user enters his choice, it will be matched with the cases’ names &#038; program execution will jump to the matching ‘Case’ &#038; the statement under that case will be executed till the keyword ‘break’ comes. It is very important else the other unwanted cases will also get executed. After the last case there is ‘default’ keyword. Statements between ‘default:’ and the closing bracket of switch-case region will be executed only if the user has entered any wrong value as his choice i.e. other than the cases’ names.</p>
<p><strong>Loop/ Iteration Statements</strong></p>
<p><strong>4. while</strong></p>
<p>while statement continually executes a block of statements while a particular condition is true. Entry controlled</p>
<p>Syntax:</p>
<pre  class="brush: java">
while(conditions)
{
//Loop body
}
</pre>
<p><strong>5. do-while</strong></p>
<p>It will enter the loop without checking the condition first and checks the condition after the execution of the statements. That is it will execute the statement once and then it will evaluate the result according to the condition.     Exit controlled</p>
<p>Syntax:</p>
<pre  class="brush: java">
do
{
//Loop body
}while(condition);
</pre>
<p><strong>6. for</strong></p>
<p>The concept of Iteration has made our life much easier. Repetition of similar tasks is what Iteration is and that too without making any errors. Until now we have learnt how to use selection statements to perform repetition.</p>
<p>Syntax:</p>
<pre  class="brush: java">
for(initialization;test condition;increment)
{
//Loop body
}
</pre>
<p><strong>Branching/ Transfer statements</strong></p>
<p><strong>7. break</strong></p>
<p>   Sometimes we use Jumping Statements in Java. Using for, while and do-while loops is not always the right idea to use because they are cumbersome to read. . Break statement skips the following code lets the execution jump to point after, where the program execution has jumped from to switch-case region.</p>
<p>Syntax:
<pre  class="brush: java">
		for(initialization;test condition;increment)
		{
			if(condition)
			{
			//statements
			break;
			}
		}
</pre>
<p><strong>8. continue</strong></p>
<p>Continue statement is just similar to the break statement in the way that a break statement is used to pass program control immediately after the end of a loop and the continue statement is used to force program control back to the top of a loop. </p>
<p>Example</p>
<pre  class="brush: java">
		for(initialization;test condition;increment)
		{
			if(condition)
			{
			//statements
			continue;
			}
		}
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-break-statement-example/" rel="bookmark" class="crp_title">Java &#8211; Break Statement Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/switch-statement-in-java/" rel="bookmark" class="crp_title">Switch Statement in JAVA</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-do-while-statement-example/" rel="bookmark" class="crp_title">Java &#8211; do while Statement Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/exception-handling-in-java/" rel="bookmark" class="crp_title">Exception Handling in Java</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/conditional-control-statement-in-java/" rel="bookmark" class="crp_title">Conditional Control Statement in JAVA</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/sql-joins-in-oracle/" rel="bookmark" class="crp_title">SQL Joins in Oracle</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/java-control-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java I/O Stream</title>
		<link>http://www.easywayserver.com/blog/java-io-stream/</link>
		<comments>http://www.easywayserver.com/blog/java-io-stream/#comments</comments>
		<pubDate>Tue, 17 May 2011 07:40:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java.io]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=757</guid>
		<description><![CDATA[By: Pankaj Yadav
It can be used to write the data on file. It provides us methods to perform various tasks on the file. In order to use this class we have to import java.IO package.
Syntax:
import java.io.*;
In this package we have input stream and output stream for read and write in a file.
Input Stream
The java.io.InputStream is [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-io-stream%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-io-stream%2F" height="61" width="51" /></a></div><p>By: Pankaj Yadav</p>
<p>It can be used to write the data on file. It provides us methods to perform various tasks on the file. In order to use this class we have to import java.IO package.</p>
<p>Syntax:</p>
<p><em>import java.io.*;</em></p>
<p>In this package we have input stream and output stream for read and write in a file.</p>
<h2>Input Stream</h2>
<p>The java.io.InputStream is the base class of the input streams in java .The input stream read data form a file with the help of  read() method. The read() method returns integer type value. If read() method does not have any byte to read returns the -1.</p>
<p>Example:</p>
<pre  class="brush: java">
InputStream inputs = new FileInputStream(&quot;c://data//file.txt&quot;);
int _idata = inputs.read();
while( _idata> -1 )
{
_idata = inputs.read();
}
</pre>
<h2>Output Stream</h2>
<p>The java.io.OutputStream is the base class of the output streams in java. The write() method is used to write the data in the file .</p>
<p>Example:</p>
<pre  class="brush: java">
import java.io.FileOutputStream;
import java.io.OutputStream;

public class OutputStreamExample {

	public static void main(String[] args) {

		try{
			OutputStream out = new FileOutputStream(&quot;c://file.txt&quot;);
			out.write(&quot;testOutputstream&quot;.getBytes());
			out.close();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}

}
</pre>
<p> We can also use these streams in the sequence to perform the different tasks. This class also provides the buffering techniques for faster performance. </p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-how-to-read-file-read-text-from-file/" rel="bookmark" class="crp_title">Java &#8211; How to Read file, Read text from File</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-edit-file-example-modify-file-java/" rel="bookmark" class="crp_title">Java &#8211; Edit File Example, Modify File java</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/properties-in-java/" rel="bookmark" class="crp_title">Properties in JAVA</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-read-file-without-datainputstream/" rel="bookmark" class="crp_title">Java &#8211; Read file without DataInputStream</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/how-to-serializable-object-in-java/" rel="bookmark" class="crp_title">How to serializable object in java</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-how-to-write-text-file-write-content-in-file/" rel="bookmark" class="crp_title">Java &#8211; How to Write text file, Write Content in File</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/java-io-stream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Environment</title>
		<link>http://www.easywayserver.com/blog/java-environment/</link>
		<comments>http://www.easywayserver.com/blog/java-environment/#comments</comments>
		<pubDate>Tue, 17 May 2011 06:16:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=752</guid>
		<description><![CDATA[By: Jatin Chawla
Java environment contains a rich set of development tools &#038; thousands of classes and methods.  It has mainly two parts:

1. Java Development Kit(JDK)
2. Java Standard Library(JSL)

Java Development Kit (JDK)
	The Java Development Kit is a software package that is provided by the &#34;SUN Microsystem&#34; to public for free of cost. Java Development kit [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-environment%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-environment%2F" height="61" width="51" /></a></div><p>By: Jatin Chawla</p>
<p>Java environment contains a rich set of development tools &#038; thousands of classes and methods.  It has mainly two parts:</p>
<ul>
<li><strong>1. Java Development Kit(JDK)</strong></li>
<li><strong>2. Java Standard Library(JSL)</strong></li>
</ul>
<h3>Java Development Kit (JDK)</h3>
<p>	The Java Development Kit is a software package that is provided by the &quot;SUN Microsystem&quot; to public for free of cost. Java Development kit is currently available for most operating systems.  It comes with a large collection of rules that are used for developing &#038; running Java programs.  It includes all the basic components that makeup the Java Environment.  It also includes Utilities documentation and sample code for developing Java Programs.  The Java Development Kit(Jdk) contains files and directories that are required to develop Java Applications after installing Java. Some Directories are following:<br />BIN, INCLUDE, JRE, LIB, DEMO etc.</p>
<p>There are following Java development tools that are used to create programs and applications.<br />
</p>
<h4>The Java Applet Viewer</h4>
<p>It enable us to run Java applets on Appletviewer window.  The executable code name is <strong>&quot;appletviewer&quot; </strong>.  It is basically used to execute applets without Java enabled Web Browser.<br />
	<br />e.g. appletviewer myapplet.java</p>
<h4>The Java Interpreter</h4>
<p>This tool enable us to run Java applets and applications by reading and interprating bytecode files.  The executable code name is <strong> &quot;java&quot;</strong>.<br />
	<br />e.g. java myfile<br />
	</p>
<h4>The Java Compiler</h4>
<p>This tool enable us to compile java source code (program) into bytecode.  The executable code name is <strong>&quot;javac&quot;</strong>.<br />
	<br />
	e.g. javac myprogram.java<br />
	</br></p>
<h4>The Java API documentation generator</h4>
<p>This tool Creates API documentation in HTML format from Java source code.  The executable code name is <strong>&quot;javadoc&quot;</strong>.<br />
	<br />
	e.g. javadoc document.java<br />
	</p>
<h4>The Java header and stub file generator</h4>
<p>	It Creates C-language header and stub files from a Java class, which allows your Java and C code to interact.  It provides header files for use with native method.  The executable code name is <strong>&quot;javah&quot;</strong>.<br />
	</p>
<h4>The Java class file Decompiler / Deconstruct</h4>
<p>	It Disassembles Java files and prints out a representation of Java bytecode.  It enables us to convert byte code files into a program description.  The executable code name is <strong>&quot;javad&quot;</strong>.<br />
	</p>
<h4>The Java language debugger</h4>
<p>	This tool helps us to find and fix errors in our program.  The executable code name is <strong>&quot;jdb&quot;</strong>.<br />
	
</p>
<h3>Java Standard Library(JSL)</h3>
<p>	It is also known as Java Application Program Interface.  The main and essential part of a human body is Heart; Same like this The main part (heart) of any programming language is Package.  It includes hundreds of classes and methods grouped into Several functioned package.  These packages provide everything that we need to create a powerful application.  There are following packages in Java Standard Library:<br />
	</p>
<h4>Langauage Support Package</h4>
<p>	It is the core set of classes for the Java language that provide basic functions, such as string and array handling.  This collection of classes and methods required for implementating basic features of Java.<br />
	<br />	<br />
<strong>Package Name: &quot;java.lang&quot;</strong><br />
	</p>
<h4>Utility Package</h4>
<p>	It is the collection of classes to provide utility function such as date and time function, encoding/decoding, hash tables, and stacks.<br />
	<br />
<strong> Package Name:&quot;java.util&quot;</strong><br />
	</p>
<h4>Input / Output Package</h4>
<p>	A set of classes provide the standard input / outputs and file I / O manipulation.<br />
	<br />
<strong>Package Name: &quot;java.io&quot;</strong><br />
	</p>
<h4>Network Package</h4>
<p>	A set of classes that provide tools for accessing / communicating with other networks by protocols, such as FTP, Telnet, and HTTP (Internet Means).<br />
	<br />
<strong>Package Name: &quot;java.net&quot;</strong><br />
	</p>
<h4>AWT Package</h4>
<p>	AWT (Abstract Window Toolkit) Package contains classes that implements platform independent graphical user interface such as buttons, labels, frames etc.<br />
	<br />
<strong>Package Name: &quot;java.awt&quot;</strong>.<br />
	<br />
	It also include other package like &quot;java.awt.image&quot;, &quot;java.awt.peer&quot; etc.<br />
	</p>
<h4>Applet Package</h4>
<p>	This includes a set of classes that allows us to create java applets; This relate to the applet environment and are generally used when viewing applets.<br />
	<br />
<strong>Package Name: &quot;java.applet&quot;</strong><br />
	</p>
<h4>SQL Package</h4>
<p>	It enables us to create and develop java application that access database.<br />
	<br />
<strong> Package Name: &quot;java.sql&quot;</strong></p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/overview-of-java-virtual-machine/" rel="bookmark" class="crp_title">Overview of Java Virtual Machine</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/learn-java-programming/" rel="bookmark" class="crp_title">Learn Java Programming</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-oop-concept/" rel="bookmark" class="crp_title">Java OOP Concept</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/way-to-start-java-programming/" rel="bookmark" class="crp_title">Way to start Java Programming</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-abstract-classes-and-methods/" rel="bookmark" class="crp_title">Java &#8211; Abstract Classes and Methods</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/difficult-to-find-java-web-hosting/" rel="bookmark" class="crp_title">Difficult to Find Java Web hosting</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/java-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Inheritance</title>
		<link>http://www.easywayserver.com/blog/java-inheritance/</link>
		<comments>http://www.easywayserver.com/blog/java-inheritance/#comments</comments>
		<pubDate>Tue, 17 May 2011 05:54:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=749</guid>
		<description><![CDATA[By: Jatin Chawla
Java Inheritance is one of the key concept of OOP language that enables us to arrange the classes in hierarchical form / tree structure just like a child / baby inherit the characteristics of his parents and develop new characteristics of his / her own.  In similar way, in Java a programmer [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-inheritance%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-inheritance%2F" height="61" width="51" /></a></div><p>By: Jatin Chawla</p>
<p>Java Inheritance is one of the key concept of OOP language that enables us to arrange the classes in hierarchical form / tree structure just like a child / baby inherit the characteristics of his parents and develop new characteristics of his / her own.  In similar way, in Java a programmer can write a new class that can adopt / inherit the accessible (type modifier) fields and methods of existing class and can include new attributes.  It allows us to easily reuse code and extend the functionality of existing class.</p>
<p><strong>Definition:</strong> The inclusion of members of the existing class in a new class so that they are accessible in the new class is known as INHERITANCE.
</p>
<p></p>
<p>Using this aspect of OOP, we can create a new class from the already existing class.  We can extends the functionality of the old class in the way that suit our current need.  The television class can contain the subclasses such as B/W Television, Color Television and Home Theater style television.  The new class is called Derived Class, Sub Class, Child Class; The existing (OLD) class that is being inherited is called as Super, Base, Parent Class.  Once the super class has been written, tested and debugged; Its functionality can be reused by the sub class rather than being rewrite from the screen.</p>
<p></p>
<p>In Java, One class can be inherited from another by using &quot;extends&quot; keyword.  A new class cannot be inherited from more than two class means one class cannot be a sub class of more than two classes </p>
<pre class="brush: java">
	class sub_class_name extends super_class
	{
		Member 1;
		Member 2;
	}
</pre>
<p><strong>There are three types of Inheritance:</strong></p>
<ul>
<li><strong>1. Simple Inheritance:</strong> In this type of Inheritance, a single class is inherited all attributes from super class.  <b>e.g.</b> Every person has a name and age, some persons may be student that have a roll no. and class i.e. Every student has a name ,age, roll no. and class.</li>
<li><strong>2. Multilevel Inheritance:</strong> In this type of Inheritance, a single class is inherited all attributes from super class and the derived class further derive a new class and adopt all the features of that class.  <b>e.g. </b> Every person has a name and age, some persons may be student that have a roll no. and class.  Every student contain some subjects and their results then we organise all of them in a simple manner i.e. Every student has a name, age, roll no., class, subjects and their results.</li>
<li><strong>3. Hierarchical Inheritance:</strong> In this type of Inheritance, a  single class derives more than two classes.  <b> e.g.</b> Every person has a name and age, some persons may be student that have a roll no. and class; And In other way every employee has a unique ID in his / her organisation and designation. Then we can say that every student has a name, age, roll no. and class and every employee has a name, age, ID, Designation.</li>
</ul>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-oop-concept/" rel="bookmark" class="crp_title">Java OOP Concept</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-simple-inheritance/" rel="bookmark" class="crp_title">Java Simple Inheritance</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-multiple-inheritance-example/" rel="bookmark" class="crp_title">Java Multiple Inheritance Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/interface-program-in-java/" rel="bookmark" class="crp_title">Interface Program in Java</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-abstract-classes-and-methods/" rel="bookmark" class="crp_title">Java &#8211; Abstract Classes and Methods</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-inheritance-extends-program/" rel="bookmark" class="crp_title">Java inheritance extends Program</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/java-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Strings</title>
		<link>http://www.easywayserver.com/blog/java-strings/</link>
		<comments>http://www.easywayserver.com/blog/java-strings/#comments</comments>
		<pubDate>Sun, 15 May 2011 14:59:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=741</guid>
		<description><![CDATA[Java Strings
By: Pankaj Yadav
 It represents a sequence of characters. In java, Strings are class object and implements using the three classes as following
*.String
*.StringBuffer
*.StringBuilder
String: It is an object of the String class. It can be created as follows:
Syntax:

String  StringName;
String name = new String("string");

Example:

  String name;

  name = new String("Panakj");
  //And it [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-strings%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-strings%2F" height="61" width="51" /></a></div><p><strong>Java Strings</strong></p>
<p>By: Pankaj Yadav</p>
<p> It represents a sequence of characters. In java, Strings are class object and implements using the three classes as following</p>
<p>*.String</p>
<p>*.StringBuffer</p>
<p>*.StringBuilder</p>
<p>String: It is an object of the String class. It can be created as follows:</p>
<p><strong>Syntax:</strong></p>
<pre  class="brush: java">
String  StringName;
String name = new String("string");
</pre>
<p>Example:</p>
<pre  class="brush: java">
  String name;

  name = new String("Panakj");
  //And it can be same done as follows:

  String name= new String ("Pankaj");
</pre>
<p><strong>String Array</strong></p>
<p>String array can be created as follows:</p>
<pre  class="brush: java">
String  nameArray[]= new String[3];
</pre>
<p><strong>Java String Methods</strong></p>
<p>String class has a number of methods that allows us to accomplish a variety of string manipulations. And the methods of java string class as follows:</p>
<p><strong>toLowerCase()</strong>        Convert the whole string to lower case</p>
<p><strong>toUpperCase()</strong>		Convert the string to upper case</p>
<p><strong>replace(&#8221;x&#8221;,&#8221;y&#8221;)</strong>		replaces the x with y</p>
<p><strong>trim()</strong>				removes the white spaces from  beginning and end of string</p>
<p><strong>equals()</strong>			True if the first string is equal to the other string</p>
<p><strong>equalsIgnoreCase()</strong> 	Ignore String letters A=a are equals and Returns if firststr=secondstr</p>
<p><strong>length()</strong>			gives length of the string</p>
<p><strong>charAt(n)</strong>		returns the nth character of the string</p>
<p><strong>compareTo()</strong>		Returns negative if s1<s2 ,positive if s1>s2, and zero on s1=s2</p>
<p><strong>concat()</strong>		Concatenates string first with second</p>
<p><strong>substring(n)</strong>		it returns the part of string between from nth place</p>
<p><strong>substring(n,m)</strong>	returns string between n and m characters</p>
<h3>Java String Examples:</h3>
<pre  class="brush: java">

class StringJavaExample
{
	static String name[]={"Pankaj","Amit","Jon","Marry","Vinita"};

	public static void main(String args[])
	{
		int size=name.length;
		String temp=null;
		for(int i=0;i&lt;size;i++)
		{
			for(int j=i+1;j&lt;size;j++)
			{
				if (name[j].compareTo(name[i])&lt;0)
				{
					//swaping string
					temp=name[i];
					name[i]=name[j];
					name[j]=temp;
				}
			}
		}
		for (int i=0;i&lt;size;i++)
		{
			System.out.println(name[i]);
		}
	}
}
</pre>
<p><strong>Output</strong></p>
<p><i></p>
<p>Amit</p>
<p>Jon</p>
<p>Marry</p>
<p>Pankaj</p>
<p>Vinita</p>
<p></i></p>
<p><strong>Java StringBuffer Class:</strong></p>
<p>String creates a fixed length. Where StringBuffer creates strings of flexible length and can be modified.</p>
<p>The methods of the StringBuffer class as follows:</p>
<p>setChartAt(n,’x’)		Modifies nth character to x</p>
<p>append()			it appends stri1 to str2</p>
<p>insert(n,str2)	inserts str2 at nth positon str1</p>
<p>setLength(n)		Set the length  of the string to n.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-class-examples/" rel="bookmark" class="crp_title">Java Class Examples</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/why-stringbuffer-in-java-synchronized/" rel="bookmark" class="crp_title">Why Stringbuffer in Java Synchronized</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-stringbuffer-length-example-stringbuffer-length-program-calculate-length/" rel="bookmark" class="crp_title">Java &#8211; StringBuffer length() Example, StringBuffer length() program, Calculate Length</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/why-hashtable-in-java-synchronized/" rel="bookmark" class="crp_title">Why Hashtable in Java Synchronized</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-stringbuffer-substring-example-stringbuffer-substring-program/" rel="bookmark" class="crp_title">Java &#8211; StringBuffer substring() Example, StringBuffer substring() program</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-%e2%80%93-string-split-example-strings-split-program/" rel="bookmark" class="crp_title">Java – String split() Example, Strings split() program</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/java-strings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Data Types in Java</title>
		<link>http://www.easywayserver.com/blog/data-types-in-java/</link>
		<comments>http://www.easywayserver.com/blog/data-types-in-java/#comments</comments>
		<pubDate>Sun, 15 May 2011 07:10:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=732</guid>
		<description><![CDATA[Data Types in Java
By: Pankaj Yadav
It is a classification in programming languages which indicates the type of value a variable can store. Different types of values are there &#038; different operations are there for every data type. e.g.
Following statements declares 2 variables of datatypes int and char &#038; also initializes

int  _iVar = 4;  [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fdata-types-in-java%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fdata-types-in-java%2F" height="61" width="51" /></a></div><p><strong>Data Types in Java</strong></p>
<p>By: Pankaj Yadav</p>
<p>It is a classification in programming languages which indicates the type of value a variable can store. Different types of values are there &#038; different operations are there for every data type. e.g.</p>
<p>Following statements declares 2 variables of datatypes<b> int</b> and<b> char</b> &#038; also initializes</p>
<pre  class="brush: java">
int  _iVar = 4;       //'_iVar' can store only numbers
char  _cVar = 'c';   //'_cVar' can store both numbers &#038; characters
</pre>
<p>There are 2 groups of data types in Java Primitive and Non- Primitive.
<p>
<h3>Primitive Data Types</strong></h3>
<p>Variables of these data types store the actual data or the primitive value. They are passed by value. There are 8 primitive datatypes in Java:- int, char, byte, short, long, float, double and boolean.</p>
<table width="100%" cellpadding="0" cellspacing="0" class="br">
<tr>
<td><strong>Data Type </strong></td>
<td width="100px"><strong>Size</strong></td>
<td width="200px"><strong>Range</strong></td>
</tr>
<tr>
<td> int </td>
<td>32-bit</td>
<td>-2,147,483,648 to 2,147,483,647</td>
</tr>
<tr>
<td>short</td>
<td>16-bit</td>
<td>-32,768 to 32,767</td>
</tr>
<tr>
<td>long</td>
<td>64-bit</td>
<td>-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807</td>
</tr>
<tr>
<td>byte</td>
<td>8-bit</td>
<td>-128 to 127</td>
</tr>
<tr>
<td>float</td>
<td>32-bit</td>
<td>1.40129846432481707e-45 to 3.40282346638528860e+38</td>
</tr>
<tr>
<td>double</td>
<td>64-bit</td>
<td>4.94065645841246544e-324d to 1.79769313486231570e+308d</td>
</tr>
<tr>
<td>char</td>
<td>16-bit</td>
<td>0 to 65,535</td>
</tr>
<tr>
<td>boolean</td>
<td>1-bit</td>
<td>True or False only</td>
</tr>
</table>
<p>To get minimum &#038; maximum values of a datatype:</p>
<pre  class="brush: java">
Datatype_Name.MIN_VALUE				// lower limit
Datatype_Name.MAX_VALUE				// upper limit
</pre>
<p>Primitive datatypes have a limit of values (range) &#038; also they have a default values till programmer assigns which are described in the following table along with their size &#038; format.</p>
<p>Example of Primitive Dat Type</p>
<pre  class="brush: java">

int a = 8;                      //a contains value 3
int b = a;                      //b contains copy of a
    b = 5;                      // Changing b

                                // Now, b = 5 and a = 8
                                // no change in a
</pre>
<p><strong>Non-Primitive Data Types </strong></p>
<p>Variables of non-primitive datatypes or object references stores reference to the actual value stored in the primitive variable.</p>
<p><strong>Objects </strong> (Classes &#038; Interfaces) and <strong>Arrays</strong>  are the reference or non-primitive data types in Java. They are so called because they are handled &#8220;by reference&#8221; i.e. variables of their type store the address of the object or array is stored in a variable. They are passed by reference. For Ex:</p>
<pre  class="brush: java">
char[]  arr = { 'a', 'b', 'c', 'd' };		//'arr' stores the references for the 4 values
</pre>
<p>Example of Non-Primitive Dat Type</p>
<pre  class="brush: java">

Button a, b;                  //Objects of type Button
a = new Button();              //a object created
b = a;                         //b object created
                               //&#038; filled with a
a.var = 8;
b.var = 5;                //Assign values
                          // Now, b = a = 5
                         //a is changed
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-short-example/" rel="bookmark" class="crp_title">Java &#8211; Short Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-long-example/" rel="bookmark" class="crp_title">Java &#8211; Long Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-types-of-ejb/" rel="bookmark" class="crp_title">Java &#8211; Types of EJB</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-float-example/" rel="bookmark" class="crp_title">Java &#8211; Float Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-double-example/" rel="bookmark" class="crp_title">Java &#8211; Double Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-class-examples/" rel="bookmark" class="crp_title">Java Class Examples</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/data-types-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exception Handling in Java</title>
		<link>http://www.easywayserver.com/blog/exception-handling-in-java/</link>
		<comments>http://www.easywayserver.com/blog/exception-handling-in-java/#comments</comments>
		<pubDate>Wed, 11 May 2011 02:00:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=727</guid>
		<description><![CDATA[By: Pankaj Yadav
Exceptions are the error those may lead to incorrect output or may terminate the execution of program and may even cause system crash.
Types of Exceptions

1. Compile time Exception
2. Run Time Exception

Compile time Exception
These exceptions may rise during compilation of program. And these errors may be raised by the compiler. There may be the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fexception-handling-in-java%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fexception-handling-in-java%2F" height="61" width="51" /></a></div><p>By: Pankaj Yadav</p>
<p>Exceptions are the error those may lead to incorrect output or may terminate the execution of program and may even cause system crash.</p>
<p>Types of Exceptions</p>
<ul>
<li><strong>1. Compile time Exception</strong></li>
<li><strong>2. Run Time Exception</strong></li>
</ul>
<h3>Compile time Exception</h3>
<p>These exceptions may rise during compilation of program. And these errors may be raised by the compiler. There may be the following reasons for exception:<br />
<br /><strong>We can declare fields as follows:</strong></br></p>
<ul>
<li>1. Due to missing of semi colon.</li>
<li>2. Due to missing class and method bracket</li>
<li>3. Misspelling of the identifiers and keywords</li>
<li>4. Missing double quotation in strings</li>
<li>5. Used of undeclared variables </li>
<li>6. Incomplete types in assignment/initialization</li>
<li>7. Use of Bad reference object</li>
</ul>
<h3>Run-time Exception</h3>
<p>These exceptions may rise during run of program. Most of the common exceptions may rise due to:</p>
<ul>
<li>1. Dividing by zero</li>
<li>2. Accessing element out of the index of the array</li>
<li>3. Trying to insert values of the variable not of the type</li>
</ul>
<p><strong>Steps for Exception Handling</strong></p>
<ul>
<li>1. Find the problem (Hit exception)</li>
<li>2. Inform about the exception(Throw exception)</li>
<li>3. Receive the exception(Catch exception)</li>
<li>4. Correct the exception(Handling exception)</li>
</ul>
<p>Syntax of Exception Handling</p>
<pre class="brush: java">
try
{
statements			//generates an exception
}
catch (Exception e)
{
statement			//process the exception
}
</pre>
</p>
<p><strong>Multiple catch Statements</strong></p>
<p>It is possible to have more than one catch statement in the catch block</p>
<p>Syntax for method:</p>
<p>&nbsp;</p>
<p><strong>Using finally</strong></p>
<p>Java supports finally statement that can be used to handle exception that is not caught by any previous catch statement. Finally block is used to handle any error generated in the try block.</p>
<p><strong>Syntax</strong></p>
<pre class="brush: java">
	try
		{
			//		statement
		}
		catch(ExceptionSubClass1 ex1)
		{
			//		statements
		}
		catch(ExceptionSubClass2 ex2)
		{
			//		statements
		}
		finally
		{
			//		statements
		}
</pre>
<p><strong>User Defined Exception</strong></p>
<p>There are many times when we have to throw exceptions .This we can do with the help of throw as follows:</p>
<pre class="brush: java">

throw new ArithmaticException();
throw new NumberFormatException();
</pre>
<p>Note: Mainly all user defined classes are subclass of Throwable.</p>
<p><strong>Example</strong></p>
<pre class="brush: java">
import java.lang. Exception;

class MyException extends Exception
{

	MyException(String message)
	{
		super(message);
	}

}

class TestmMyException
{

	public  static void main(String args[])
	{

		int x=5,y=1000;
		try
		{
			float z=(float)x/(float)y;
			if(z&lt;0.01)
			{
				throw new MyException("number is small");
			}
		}
		catch(MyException e)
		{
			System.out.println("Exception caught");
		}
		finally
		{
			System.out.println("Finally bloc Always executes");
		}
	}

}
</pre>
<p><strong>output</strong></p>
<p>
<i><br />
Exception caught<br />
Finally bloc Always executes<br />
Press any key to continue&#8230;<br />
</i></p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-try-catch-exceptions-example/" rel="bookmark" class="crp_title">Java Try Catch Exceptions Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-finally-block-example/" rel="bookmark" class="crp_title">Java Finally block Example</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-exceptions-subclass/" rel="bookmark" class="crp_title">Java Exceptions Subclass</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/learn-java-programming/" rel="bookmark" class="crp_title">Learn Java Programming</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-control-statements/" rel="bookmark" class="crp_title">Java Control Statements</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/how-to-serializable-object-in-java-2/" rel="bookmark" class="crp_title">How to save java object in database</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/exception-handling-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java OOP Concept</title>
		<link>http://www.easywayserver.com/blog/java-oop-concept/</link>
		<comments>http://www.easywayserver.com/blog/java-oop-concept/#comments</comments>
		<pubDate>Tue, 10 May 2011 07:36:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.easywayserver.com/blog/?p=723</guid>
		<description><![CDATA[By: Jatin Chawla
Object Oriented Programming is an approach to organize and develop the program, which attempts to eliminate some of the drawbacks of Conventional Programming methods .  All the  languages are not suitable with OOP concept.  Language that support OOP concept / features include C++, ADA, Object Pascal, Java.  C++ is [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-oop-concept%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.easywayserver.com%2Fblog%2Fjava-oop-concept%2F" height="61" width="51" /></a></div><p>By: Jatin Chawla</p>
<p>Object Oriented Programming is an approach to organize and develop the program, which attempts to eliminate some of the drawbacks of Conventional Programming methods .  All the  languages are not suitable with OOP concept.  Language that support OOP concept / features include C++, ADA, Object Pascal, Java.  C++ is basically a procedural language that follow only some features of OOP.  Java is a core Object Oriented Programming Language.
<p>There are following features of OOP followed by Java:<br />
<h2>Objects and Classes</h2>
<p>Object is similar like an entity such as table, chair, pen etc. Every entity has some its behavior and attributes.</p>
<p>A person is also an object that has some behaviours (methods) such as To walk, To breathe, To listen, To talk, To see etc. that are accomplished by some of its attributes i.e. Nose, Eye, Ear, Legs etc.</p>
<p>They may represent any living or non living entity like a person, a place, a bank account, a record of student etc.  Program objects should be chosen in a manner they match closely with real word objects.</p>
<p>When a program is executed, the objects interact by sending message from one to another.  To create an object in Java, we use following syntax.</p>
<pre  class="brush: java">
class &lt;Class name&gt;
{
	…………………	//Class body
 	…………………	//Class body
	…………………	//Class body
}
</pre>
<p>e.g. Student s;</p>
<p>Class is a building block of Java. It is a logical way to group together Fields that hold values and associated methods that operate on these fields into a single unit.  To create a class in Java, we use following syntax.</p>
<pre  class="brush: java">
&lt;Class name&gt; &lt;Object name&gt;;
</pre>
<p>example</p>
<pre  class="brush: java">
class Student
{
		int roll;
		String name;

		public void get()
		{
			roll=20;
			name="Jatin";
		}
}
</pre>
<h2>Data Abstraction and Encapsulation</h2>
<p>The process of linking / binding data and associated code / procedures  to make them a compound unit, is called data encapsulation.  When data and code is associated with one another, they create objects.  These objects support the Encapsulation mechanism.  In this process, the data OR code may be public / private / protected / friendly etc.   Private code is only accessible by the particular part of that object, whereas public code is accessible by any other object.</p>
<p>Abstraction is a very classic feature that defines only fundamental / vital information without involving the Source code information or elaboration.  When we use the social networking sites such as facebook, orkut etc. OR any other sites; we only complete the particular task.  We does not check the source code of that webpage.  Let we talk about our daily life, when we have softdrink; we only enjoy the taste of that, we does not try to know which type of chemicals are used for preparing this.</p>
<h2>Inheritance</h2>
<p>Inheritance means Heredity i.e. Transfer some qualities and attributes of parents to their children.  Inheritance is a process to  derive new classes from already existing classes.  Existing class is called Super / Base / Parent class and new class is known as Sub / Derived / child class.  This process defines the characteristics hold by Super class, inherited by the sub class.  The basic way to adopt this concept is that work again with the same qualities / standards.</p>
<p>e.g. If we talk about persons, every person has a name; If we talk about students, every student is a person and it acquire the attributes of person class.</p>
<p>There are three type of inheritance:</p>
<ul>
<li><strong>1. Simple Inheritance</strong> <br /><img src="http://www.easywayserver.com/images/blog/simpleInheritance.jpg" border="0" /></li>
<li><strong>2. Multilevel Inheritance</strong> <br /><img src="http://www.easywayserver.com/images/blog/multilevelInheritance.jpg" border="0" /></li>
<li><strong>3. Hierarchical Inheritance</strong> <br /><img src="http://www.easywayserver.com/images/blog/hierarchicalInheritance.jpg" border="0" /></li>
</ul>
<h2>Polymorphism</h2>
<p>Polymorphism is very striking concept. In formal way Polymorphism means having or passing through many stages of development.  In technical language, Poly means many and morphism means the process to change e.g. when we change one image to another image using computer animation tools, it means we are changing the form of one image to further (Basic image to Advanced).</p>
<p>e.g. In our family and in our social network, usually we are known as different-different name. </p>
<p>We can use this concept to create and define multiple level of interface.</p>
<p>If we talk about Method Overloading, There is a group of methods having same name but differ in argument / parameter list.  Method overloading does not depend on return type of method.  This is the type of Multiple Polymorphism.</p>
<p>Method overriding is the type of Single Polymorphism.</p>
<h3>Dynamic Binding</h3>
<p>In our daily life, Binding means something that link together to any other thing. In java, Binding refers to the linking of procedures call to the code to be executed in response to the call.  In other words, Binding is a process that links / connects the objects to procedures / methods / functions in a single unit called class.</p>
<h3>Message Communication</h3>
<p>This is a process through which objects can interact / communicate with one another.  People pass / send messages to one another through many means such as Mobile, Letter etc.  In the similar way Object communicate with one another by sending and receiving information through requesting their procedures / methods.</p>
<p><img src="http://www.easywayserver.com/images/blog/messagecommunication.jpg" border="0" /> <br />Figure: Passing message</p>
<div id="crp_related"><h3>Related Posts:</h3><ul style="list-style:disc;padding-left:20px"><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-inheritance/" rel="bookmark" class="crp_title">Java Inheritance</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/overview-of-java-virtual-machine/" rel="bookmark" class="crp_title">Overview of Java Virtual Machine</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-simple-inheritance/" rel="bookmark" class="crp_title">Java Simple Inheritance</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/interface-program-in-java/" rel="bookmark" class="crp_title">Interface Program in Java</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-environment/" rel="bookmark" class="crp_title">Java Environment</a></li><li style="padding-left:8px"><a href="http://www.easywayserver.com/blog/java-types-of-ejb/" rel="bookmark" class="crp_title">Java &#8211; Types of EJB</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.easywayserver.com/blog/java-oop-concept/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

