<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-23422423</id><updated>2012-02-01T09:24:19.904-08:00</updated><title type='text'>Concepts and Code for U</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-23422423.post-7602627890725963654</id><published>2007-09-18T01:35:00.000-07:00</published><updated>2007-09-18T01:36:29.666-07:00</updated><title type='text'>Exception Handling in PL/SQL-1</title><content type='html'>DECLARE&lt;br /&gt;v_err_code number;&lt;br /&gt;v_err_text varchar (255);&lt;br /&gt;myexp Exception;&lt;br /&gt;   PRAGMA EXCEPTION_INIT(myexp,-2292);&lt;br /&gt;N number:=10;&lt;br /&gt;Y number:=0;&lt;br /&gt;begin&lt;br /&gt;if y=0&lt;br /&gt;then&lt;br /&gt;raise myexp;&lt;br /&gt;else&lt;br /&gt;  N:=10/Y;&lt;br /&gt;end if;&lt;br /&gt;Exception&lt;br /&gt;When myexp then&lt;br /&gt;Y:=2;&lt;br /&gt;N:=N/Y;&lt;br /&gt;DBMS_output.put_line('zero divide exception error');&lt;br /&gt;v_err_code:=SQLCODE;&lt;br /&gt;v_err_text:=SQLERRM;&lt;br /&gt;DBMS_output.put_line('value of N is after division is : ' || N);&lt;br /&gt;DBMS_output.put_line('value of Y changed : ' || Y);&lt;br /&gt;DBMS_OUTPUT.PUT_LINE(v_err_code || '   Description is  ' ||v_err_text);&lt;br /&gt;end;&lt;br /&gt;/&lt;br /&gt; &lt;br /&gt;DECLARE&lt;br /&gt;v_err_code number;&lt;br /&gt;v_err_text varchar (255);&lt;br /&gt;myexp Exception;&lt;br /&gt;   PRAGMA EXCEPTION_INIT(myexp,-2292);&lt;br /&gt;N number:=10;&lt;br /&gt;Y number:=0;&lt;br /&gt;begin&lt;br /&gt;if y=0&lt;br /&gt;then&lt;br /&gt;raise myexp;&lt;br /&gt;else&lt;br /&gt;  N:=10/Y;&lt;br /&gt;end if;&lt;br /&gt;Exception&lt;br /&gt;When myexp then&lt;br /&gt;RAISE_APPLICATION_ERROR (-20001, 'divide by zero------.');&lt;br /&gt;Y:=2;&lt;br /&gt;N:=N/Y;&lt;br /&gt;DBMS_output.put_line('zero divide exception error');&lt;br /&gt;v_err_code:=SQLCODE;&lt;br /&gt;v_err_text:=SQLERRM;&lt;br /&gt;DBMS_output.put_line('value of N is after division is : ' || N);&lt;br /&gt;DBMS_output.put_line('value of Y changed : ' || Y);&lt;br /&gt;DBMS_OUTPUT.PUT_LINE(v_err_code || '   Description is  ' ||v_err_text);&lt;br /&gt;end;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-7602627890725963654?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/7602627890725963654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=7602627890725963654' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/7602627890725963654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/7602627890725963654'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2007/09/exception-handling-in-plsql-1.html' title='Exception Handling in PL/SQL-1'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-1640183492815759639</id><published>2007-09-18T01:34:00.002-07:00</published><updated>2007-09-18T01:35:17.493-07:00</updated><title type='text'>Exception Handling in PL/SQL</title><content type='html'>DECLARE&lt;br /&gt;MEMNAME EMP.ENAME%TYPE;&lt;br /&gt;BEGIN&lt;br /&gt;SELECT ENAME INTO MEMNAME FROM EMPKRIS&lt;br /&gt;WHERE EMPNO = &amp;INPUT_EMPNO;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE(MEMNAME);&lt;br /&gt;EXCEPTION&lt;br /&gt;WHEN NO_DATA_FOUND THEN&lt;br /&gt;DBMS_OUTPUT.PUT_LINE('No Such Employee');ed&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;DECLARE&lt;br /&gt;N number:=10;&lt;br /&gt;Y number:=0;&lt;br /&gt;i number;&lt;br /&gt;begin&lt;br /&gt;for i in -2..2&lt;br /&gt;loop&lt;br /&gt;y:=i;&lt;br /&gt;begin&lt;br /&gt;N:=10/y;&lt;br /&gt;DBMS_output.put_line('value of N is after division is : ' || N);&lt;br /&gt;Exception&lt;br /&gt;When ZERO_Divide then&lt;br /&gt;DBMS_output.put_line('value of Y is ::  ' || Y || '  exception caught');&lt;br /&gt;Y:=100;&lt;br /&gt;N:=10/y;&lt;br /&gt;DBMS_output.put_line('value of N is after division in exception block : ' || N);&lt;br /&gt;end;&lt;br /&gt;end loop;&lt;br /&gt;end;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-1640183492815759639?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/1640183492815759639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=1640183492815759639' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/1640183492815759639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/1640183492815759639'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2007/09/exception-handling-in-plsql.html' title='Exception Handling in PL/SQL'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-8706296450878012984</id><published>2007-09-18T01:34:00.001-07:00</published><updated>2007-09-18T01:34:32.159-07:00</updated><title type='text'>Looping in PL/SQL</title><content type='html'>DECLARE&lt;br /&gt;           CURSOR  emp_cur IS SELECT empno,sal,deptno&lt;br /&gt;           FROM empkris;&lt;br /&gt;v_sal empkris.sal%TYPE;&lt;br /&gt;v_empno empkris.empno%TYPE;&lt;br /&gt;v_deptno empkris.deptno%TYPE;&lt;br /&gt;v_ename empkris.ename%TYPE;&lt;br /&gt;BEGIN&lt;br /&gt;           IF emp_cur%ISOPEN THEN&lt;br /&gt;           CLOSE emp_cur;&lt;br /&gt;           end if;&lt;br /&gt;           OPEN emp_cur;&lt;br /&gt;           LOOP&lt;br /&gt;           FETCH emp_cur INTO v_empno,v_sal,v_deptno;&lt;br /&gt;           EXIT when emp_cur%NOTFOUND;&lt;br /&gt;           DBMS_OUTPUT.PUT_LINE( 'Employee number is  : ' || v_empno  || ' his salary is   :'|| v_sal || ' and he works in dept no   :'|| v_deptno);&lt;br /&gt;           END LOOP;&lt;br /&gt;           CLOSE emp_cur;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt; &lt;br /&gt;DECLARE&lt;br /&gt;           CURSOR  emp_cur IS SELECT empno,sal,deptno&lt;br /&gt;           FROM empkris;&lt;br /&gt;v_sal empkris.sal%TYPE;&lt;br /&gt;v_empno empkris.empno%TYPE;&lt;br /&gt;v_deptno empkris.deptno%TYPE;&lt;br /&gt;v_ename empkris.ename%TYPE;&lt;br /&gt;BEGIN&lt;br /&gt;For c in emp_cur &lt;br /&gt;           LOOP&lt;br /&gt;           v_empno:=c.empno;&lt;br /&gt;           v_deptno:=c.deptno;&lt;br /&gt;           v_sal:=c.sal;&lt;br /&gt;           FETCH emp_cur INTO v_empno,v_sal,v_deptno;&lt;br /&gt;           DBMS_OUTPUT.PUT_LINE( 'Employee number is  : ' || v_empno  || ' his salary is   :'|| v_sal || ' and he works in dept no   :'|| v_deptno);&lt;br /&gt;           END LOOP;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;v_sal empkris.sal%TYPE;&lt;br /&gt;v_empno empkris.empno%TYPE;&lt;br /&gt;v_deptno empkris.deptno%TYPE;&lt;br /&gt;v_ename empkris.ename%TYPE;&lt;br /&gt;v_empnon empkris.empno%TYPE:=999;&lt;br /&gt;CURSOR c_employee is select empno,deptno from empkris where empno=v_empnon;&lt;br /&gt;BEGIN&lt;br /&gt;OPEN c_employee;&lt;br /&gt;           LOOP&lt;br /&gt;           FETCH c_employee INTO v_empno,v_deptno;&lt;br /&gt;EXIT WHEN c_employee%NOTFOUND;&lt;br /&gt;           DBMS_OUTPUT.PUT_LINE( 'Employee number is  : ' || v_empno  || ' and he works in dept no   :'|| v_deptno);&lt;br /&gt;           END LOOP;&lt;br /&gt;END;&lt;br /&gt;/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-8706296450878012984?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/8706296450878012984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=8706296450878012984' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/8706296450878012984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/8706296450878012984'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2007/09/looping-in-plsql.html' title='Looping in PL/SQL'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-5942962053909346163</id><published>2007-09-18T01:29:00.000-07:00</published><updated>2007-09-18T01:33:00.161-07:00</updated><title type='text'>Sample cursors in PL/SQL</title><content type='html'>DECLARE&lt;br /&gt;           CURSOR  emp_cur IS SELECT empno,sal,deptno&lt;br /&gt;           FROM empkris;&lt;br /&gt;v_sal empkris.sal%TYPE;&lt;br /&gt;v_empno empkris.empno%TYPE;&lt;br /&gt;v_deptno empkris.deptno%TYPE;&lt;br /&gt;v_ename empkris.ename%TYPE;&lt;br /&gt;BEGIN&lt;br /&gt;           IF emp_cur%ISOPEN THEN&lt;br /&gt;           CLOSE emp_cur;&lt;br /&gt;           end if;&lt;br /&gt;           OPEN emp_cur;&lt;br /&gt;           LOOP&lt;br /&gt;           FETCH emp_cur INTO v_empno,v_sal,v_deptno;&lt;br /&gt;           EXIT when emp_cur%NOTFOUND;&lt;br /&gt;           DBMS_OUTPUT.PUT_LINE( 'Employee number is  : ' || v_empno  || ' his salary is   :'|| v_sal || ' and he works in dept no   :'|| v_deptno);&lt;br /&gt;           END LOOP;&lt;br /&gt;           CLOSE emp_cur;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;           CURSOR  emp_cur IS SELECT empno,sal,deptno&lt;br /&gt;           FROM empkris;&lt;br /&gt;v_sal empkris.sal%TYPE;&lt;br /&gt;v_empno empkris.empno%TYPE;&lt;br /&gt;v_deptno empkris.deptno%TYPE;&lt;br /&gt;v_ename empkris.ename%TYPE;&lt;br /&gt;BEGIN&lt;br /&gt;For c in emp_cur &lt;br /&gt;           LOOP&lt;br /&gt;           v_empno:=c.empno;&lt;br /&gt;           v_deptno:=c.deptno;&lt;br /&gt;           v_sal:=c.sal;&lt;br /&gt;           FETCH emp_cur INTO v_empno,v_sal,v_deptno;&lt;br /&gt;           DBMS_OUTPUT.PUT_LINE( 'Employee number is  : ' || v_empno  || ' his salary is   :'|| v_sal || ' and he works in dept no   :'|| v_deptno);&lt;br /&gt;           END LOOP;&lt;br /&gt;END;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;v_sal empkris.sal%TYPE;&lt;br /&gt;v_empno empkris.empno%TYPE;&lt;br /&gt;v_deptno empkris.deptno%TYPE;&lt;br /&gt;v_ename empkris.ename%TYPE;&lt;br /&gt;v_empnon empkris.empno%TYPE:=999;&lt;br /&gt;CURSOR c_employee is select empno,deptno from empkris where empno=v_empnon;&lt;br /&gt;BEGIN&lt;br /&gt;OPEN c_employee;&lt;br /&gt;           LOOP&lt;br /&gt;           FETCH c_employee INTO v_empno,v_deptno;&lt;br /&gt;EXIT WHEN c_employee%NOTFOUND;&lt;br /&gt;           DBMS_OUTPUT.PUT_LINE( 'Employee number is  : ' || v_empno  || ' and he works in dept no   :'|| v_deptno);&lt;br /&gt;           END LOOP;&lt;br /&gt;END;&lt;br /&gt;/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-5942962053909346163?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/5942962053909346163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=5942962053909346163' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/5942962053909346163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/5942962053909346163'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2007/09/sample-cursors-in-plsql.html' title='Sample cursors in PL/SQL'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-9133325698377631779</id><published>2007-09-18T01:25:00.000-07:00</published><updated>2007-09-18T01:29:49.772-07:00</updated><title type='text'>SQL Queries</title><content type='html'>Query to retrive top 3 records:&lt;br /&gt;&lt;br /&gt;select distinct (a.sal) from empkris a where 3 =(select count (distinct(b.sal)) from empkris bwhere a.sal&lt;=b.sal);&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Odd number of records:&lt;br /&gt;&lt;br /&gt;select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp); &lt;br /&gt;&lt;br /&gt;Even number of records: &lt;br /&gt;&lt;br /&gt;select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-9133325698377631779?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/9133325698377631779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=9133325698377631779' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/9133325698377631779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/9133325698377631779'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2007/09/sql-queries.html' title='SQL Queries'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-4179004514912723789</id><published>2007-09-12T09:13:00.000-07:00</published><updated>2007-09-12T09:15:22.126-07:00</updated><title type='text'>RandomAccessFiles in Java</title><content type='html'>import java.io.File;&lt;br /&gt;import java.io.RandomAccessFile;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;public class RandomAccessFileExample {&lt;br /&gt;&lt;br /&gt;    private static void doAccess() {&lt;br /&gt;&lt;br /&gt;       try {&lt;br /&gt;     &lt;br /&gt;            File file = new File("Test5Example.txt");&lt;br /&gt;&lt;br /&gt;            RandomAccessFile raf = new RandomAccessFile(file, "rw");&lt;br /&gt;&lt;br /&gt;            // Read a character&lt;br /&gt;&lt;br /&gt;            byte ch = raf.readByte();&lt;br /&gt;&lt;br /&gt;            System.out.println("Read first character of file: " + (char)ch);&lt;br /&gt;&lt;br /&gt;            System.out.println("Read full line: " + raf.readLine());&lt;br /&gt;&lt;br /&gt;            // Seek to the end of file&lt;br /&gt;&lt;br /&gt;            raf.seek(file.length());&lt;br /&gt;&lt;br /&gt;            // Append to the end of the file&lt;br /&gt;&lt;br /&gt;            raf.writeChars("for appending to the input file");&lt;br /&gt;&lt;br /&gt;            raf.writeBytes("this will also written into the output file");&lt;br /&gt;&lt;br /&gt;            raf.close();&lt;br /&gt;         &lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        catch (IOException e) {&lt;br /&gt;&lt;br /&gt;            System.out.println("IOException");&lt;br /&gt;&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt;        doAccess();&lt;br /&gt;&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-4179004514912723789?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/4179004514912723789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=4179004514912723789' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/4179004514912723789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/4179004514912723789'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2007/09/randomaccessfiles-in-java.html' title='RandomAccessFiles in Java'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-6634616722523385651</id><published>2007-09-12T09:06:00.000-07:00</published><updated>2007-09-12T09:12:57.213-07:00</updated><title type='text'>Program to read excel sheet Using Java program</title><content type='html'>//program to read an excel sheet Using Java program&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.util.*;&lt;br /&gt;import java.sql.*;&lt;br /&gt;&lt;br /&gt;public class TestExcel {&lt;br /&gt;&lt;br /&gt;Connection c;&lt;br /&gt;Statement stmnt;&lt;br /&gt;&lt;br /&gt;public void Read_Excel()&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;   {&lt;br /&gt;         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");&lt;br /&gt;&lt;br /&gt;         c = DriverManager.getConnection("jdbc:odbc:abc","",""); // abc is the DSN name&lt;br /&gt;         stmnt = c.createStatement();&lt;br /&gt;&lt;br /&gt;         String gh = "select * from [Offshore$]"; //Offshore being the name of the sheet in excel sheet&lt;br /&gt;&lt;br /&gt;         ResultSet rs = stmnt.executeQuery(gh);&lt;br /&gt;&lt;br /&gt;         while(rs.next())&lt;br /&gt;&lt;br /&gt;         {&lt;br /&gt;&lt;br /&gt;            System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));// for displaying the three rows present in the excel sheet&lt;br /&gt;         }&lt;br /&gt;&lt;br /&gt;       }catch(Exception e)&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;            System.out.println(""+e.toString());&lt;br /&gt;       }&lt;br /&gt;       finally&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;         try&lt;br /&gt;&lt;br /&gt;          {&lt;br /&gt;             stmnt.close();&lt;br /&gt;             c.close();&lt;br /&gt;           }&lt;br /&gt;           catch( Exception e )&lt;br /&gt;           {&lt;br /&gt;               System.err.println( e );&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args)&lt;br /&gt;    {&lt;br /&gt;       new TestExcel().Read_Excel();&lt;br /&gt;    }&lt;br /&gt; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-6634616722523385651?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/6634616722523385651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=6634616722523385651' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/6634616722523385651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/6634616722523385651'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2007/09/program-to-read-excel-sheet-using-java.html' title='Program to read excel sheet Using Java program'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-4431409007723738999</id><published>2007-08-07T11:04:00.000-07:00</published><updated>2007-08-07T11:07:18.545-07:00</updated><title type='text'>Redirect output, error report to files instead of console</title><content type='html'>&lt;tr&gt;&lt;br /&gt;import java.util.*;&lt;br /&gt;import java.lang.*;&lt;br /&gt;&lt;br /&gt;/* Program to redirect output and error report to files instead of console */&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;class errorMessage &lt;br /&gt;{&lt;br /&gt; public static void main(String[] args) &lt;br /&gt; {&lt;br /&gt; try{&lt;br /&gt;  PrintStream st = new PrintStream(new FileOutputStream("error.txt")); &lt;br /&gt;  PrintStream ps = new PrintStream(new FileOutputStream("output.txt")); &lt;br /&gt;  System.setOut(ps); &lt;br /&gt;  System.setErr(st);&lt;br /&gt;  System.out.println("output redirected to file");&lt;br /&gt;  }catch(FileNotFoundException e){&lt;br /&gt;   System.out.println("exception caught");&lt;br /&gt;  }&lt;br /&gt;  System.out.println(args[2]);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-4431409007723738999?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/4431409007723738999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=4431409007723738999' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/4431409007723738999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/4431409007723738999'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2007/08/redirect-output-error-report-to-files.html' title='Redirect output, error report to files instead of console'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-69151565449183584</id><published>2007-05-28T09:10:00.001-07:00</published><updated>2007-05-28T09:25:41.428-07:00</updated><title type='text'>Assertions in java</title><content type='html'>An assertion has a Boolean expression that, if evaluated as false, indicates a bug in the code. This mechanism provides a way to detect when a program starts falling into an inconsistent state.Using assertions helps developers write code that is more correct, more readable, and easier to maintain.J2SE 1.3 and earlier versions have no built-in support for assertions. They can, however, be provided as an ad hoc solution.&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;public class AssertionExample {&lt;br /&gt;   public static void main(String argv[]) throws IOException {&lt;br /&gt;      System.out.print("Enter your marital status: ");&lt;br /&gt;      int c = System.in.read();&lt;br /&gt;      switch ((char) c) {&lt;br /&gt;         case 's':&lt;br /&gt;         case 'S': System.out.println("Single"); break;&lt;br /&gt;         case 'm':&lt;br /&gt;         case 'M': System.out.println("Married"); break;&lt;br /&gt;         case 'd':&lt;br /&gt;         case 'D': System.out.println("Divorced"); break;&lt;br /&gt;         default: assert !true : "Invalid Option"; break;&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Make sure you use the -source option as follows:&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;prompt&gt; javac -source 1.4 AssertionExample.java&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;If you now run the program using the command&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;prompt&gt; java AssertionExample&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and you enter a valid character, it will work fine. However, if you enter an invalid character, nothing will happen. This is because, by default,assertions are disabled at runtime. To enable assertions, use the switch -enableassertion (or -ea) as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;prompt&gt; java -ea AssertionExample&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-69151565449183584?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/69151565449183584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=69151565449183584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/69151565449183584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/69151565449183584'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2007/05/assertions-in-java_28.html' title='Assertions in java'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-115073676724187826</id><published>2006-06-19T10:04:00.000-07:00</published><updated>2006-06-19T10:08:29.933-07:00</updated><title type='text'>Program to copy a folder in java</title><content type='html'>&lt;pr&gt;&lt;br /&gt;import java.io.File;&lt;br /&gt;import java.io.FileReader;&lt;br /&gt;import java.io.FileWriter;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.util.*;&lt;br /&gt;import java.lang.*;&lt;br /&gt;&lt;br /&gt;public class Copy {&lt;br /&gt;&lt;br /&gt; public static String copyFile(File inputFile,File outputFile){&lt;br /&gt;  &lt;br /&gt; String a="";&lt;br /&gt; try{&lt;br /&gt;    FileReader in = new FileReader(inputFile);&lt;br /&gt;    FileWriter out = new FileWriter(outputFile);&lt;br /&gt;    int c;&lt;br /&gt;&lt;br /&gt;    while ((c = in.read()) != -1)&lt;br /&gt;      out.write(c);&lt;br /&gt;   in.close();&lt;br /&gt;      out.close();&lt;br /&gt; }catch(Exception e){&lt;br /&gt; }&lt;br /&gt;   return a;&lt;br /&gt; }&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;  public static void main(String[] args) throws IOException {&lt;br /&gt;   Copy obj = new Copy();&lt;br /&gt;   File inputFile = new File("your input directory which you want to replicate");&lt;br /&gt;   File outputFile = new File("target directory wher U want to place");&lt;br /&gt;     boolean success = (new File("target directory wher U want to place")).mkdir();&lt;br /&gt;    if (!success) {&lt;br /&gt;        System.out.println("Cannot create folder");&lt;br /&gt;    }&lt;br /&gt;   File dir = new File("your input directory which you want to replicate");&lt;br /&gt; &lt;br /&gt;   String[] children = dir.list();&lt;br /&gt;    if (children == null) {&lt;br /&gt;        // Either dir does not exist or is not a directory&lt;br /&gt;    } else {&lt;br /&gt;        for (int i=0; i&amp;ltchildren.length; i++) {&lt;br /&gt;            // Get filename of file or directory&lt;br /&gt;            String filename = children[i];&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt; for(int p=0;p&amp;ltchildren.length;p++){&lt;br /&gt;  File f = new File(inputFile+"/"+children[p]);&lt;br /&gt;  File f1 = new File(outputFile+"/"+children[p]);&lt;br /&gt;  System.out.println(f+"==="+outputFile);&lt;br /&gt; &lt;br /&gt;  obj.copyFile(f,f1);&lt;br /&gt; }&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pr&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-115073676724187826?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/115073676724187826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=115073676724187826' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/115073676724187826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/115073676724187826'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/06/program-to-copy-folder-in-java.html' title='Program to copy a folder in java'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114693819751527858</id><published>2006-05-06T10:55:00.000-07:00</published><updated>2006-05-06T10:56:41.793-07:00</updated><title type='text'>java.net.BindException: Address already in use: JVM_Bind:8080</title><content type='html'>Both JBoss and Oracle RDBMS are using the port 8080. HTTP Server for JBoss, XDB listener for Oracle RDBMS.&lt;br /&gt;&lt;br /&gt;So is the error "java.net.BindException: Address already in use: JVM_Bind:8080"&lt;br /&gt;&lt;br /&gt;Way to over come is change the port of JBOSS change it to 8081 from 8080 in these two files given below so that you can avoid the error----- ;))&lt;br /&gt;&lt;br /&gt;1) server.xml in&lt;br /&gt;D:\jboss-3.2.6\server\all\deploy\jbossweb-tomcat50.sar&lt;br /&gt;&lt;br /&gt;2) jboss-service.xml in&lt;br /&gt;D:\jboss-3.2.6\server\all\deploy\http-invoker.sar\META-INF&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114693819751527858?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114693819751527858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114693819751527858' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114693819751527858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114693819751527858'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/05/javanetbindexception-address-already.html' title='java.net.BindException: Address already in use: JVM_Bind:8080'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114580202135351913</id><published>2006-04-23T07:16:00.000-07:00</published><updated>2006-04-23T07:20:21.676-07:00</updated><title type='text'>java.lang.UnsupportedClassVersionError:</title><content type='html'>java.lang.UnsupportedClassVersionError:&lt;br /&gt;&lt;br /&gt;When I try to compile the simple Hello program there was no problem but when trying to compile it but its giving error when tyring to run the class file&lt;br /&gt;&lt;br /&gt;class Hello &lt;br /&gt;{&lt;br /&gt; public static void main(String[] args) &lt;br /&gt; {&lt;br /&gt;  System.out.println("Hello World!");&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;Exception in thread "main" java.lang.UnsupportedClassVersionError:&lt;br /&gt;HelloWorld (Unsupported major.minor version 49.0)&lt;br /&gt;at java.lang.ClassLoader.defineClass0(Native Method)&lt;br /&gt;at java.lang.ClassLoader.defineClass(Unknown Source)&lt;br /&gt;at java.security.SecureClassLoader.defineClass(Unknown Source)&lt;br /&gt;at java.net.URLClassLoader.defineClass(Unknown Source)&lt;br /&gt;at java.net.URLClassLoader.access$100(Unknown Source)&lt;br /&gt;at java.net.URLClassLoader$1.run(Unknown Source)&lt;br /&gt;at java.security.AccessController.doPrivileged(Native Method)&lt;br /&gt;at java.net.URLClassLoader.findClass(Unknown Source)&lt;br /&gt;at java.lang.ClassLoader.loadClass(Unknown Source)&lt;br /&gt;at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)&lt;br /&gt;at java.lang.ClassLoader.loadClass(Unknown Source)&lt;br /&gt;at java.lang.ClassLoader.loadClassInternal(Unknown Source)&lt;br /&gt;&lt;br /&gt;is the error I am getting.......&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;Set the path using:&lt;br /&gt;&lt;br /&gt;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\&lt;span style="font-weight:bold;"&gt;Change it to the latest version you have installed(1.5.0 in my case)&lt;/span&gt;\bin;&lt;br /&gt;&lt;br /&gt;The error has occured becuase you have compiled the program with a latest version and trying to run it using a version which is older version.... so make it to a new version.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114580202135351913?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114580202135351913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114580202135351913' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114580202135351913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114580202135351913'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/04/javalangunsupportedclassversionerror.html' title='java.lang.UnsupportedClassVersionError:'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114576847241424118</id><published>2006-04-22T22:00:00.000-07:00</published><updated>2006-04-22T22:01:12.490-07:00</updated><title type='text'>Merge Sort</title><content type='html'>&lt;pre&gt;&lt;br /&gt;/*&lt;br /&gt; The merge sort splits the list to be sorted into two equal halves, and places them in &lt;br /&gt; separate arrays. Each array is recursively sorted, and then merged back together to &lt;br /&gt; form the final sorted list. Like most recursive sorts, the merge sort has an algorithmic &lt;br /&gt; has an complexity of O(n log n).&lt;br /&gt; Elementary implementations of the merge sort make use of three arrays - one for each half &lt;br /&gt; of the data set and one to store the sorted list in. The below algorithm merges the arrays&lt;br /&gt; in-place, so only two arrays are required. There are non-recursive versions of the merge sort, &lt;br /&gt; but they don't yield any significant performance enhancement over the recursive algorithm on &lt;br /&gt; most machines.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Pros: Marginally faster than the heap sort for larger sets.&lt;br /&gt;&lt;br /&gt;Cons: At least twice the memory requirements of the other sorts; recursive.&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;#include &amp;ltstdlib.h&gt;&lt;br /&gt;#include &amp;ltstdio.h&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void mergeSort(int numbers[], int temp[], int array_size);&lt;br /&gt;void m_sort(int numbers[], int temp[], int left, int right);&lt;br /&gt;void merge(int numbers[], int temp[], int left, int mid, int right);&lt;br /&gt;&lt;br /&gt;int numbers[10];&lt;br /&gt;int temp[10];&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;  int i;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;  printf("Enter the numbers you want to sort");&lt;br /&gt;  for(i=0;i&amp;lt10;i++)&lt;br /&gt;   scanf("%d",&amp;numbers[i]);&lt;br /&gt;  &lt;br /&gt;  //perform merge sort on array&lt;br /&gt;  mergeSort(numbers, temp, NUM_ITEMS);&lt;br /&gt;&lt;br /&gt;  printf("Done with sort.\n");&lt;br /&gt;&lt;br /&gt;  for (i = 0; i &amp;lt NUM_ITEMS; i++)&lt;br /&gt;    printf("%i\n", numbers[i]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void mergeSort(int numbers[], int temp[], int array_size)&lt;br /&gt;{&lt;br /&gt;  m_sort(numbers, temp, 0, array_size - 1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void m_sort(int numbers[], int temp[], int left, int right)&lt;br /&gt;{&lt;br /&gt;  int mid;&lt;br /&gt;&lt;br /&gt;  if (right &gt; left)&lt;br /&gt;  {&lt;br /&gt;    mid = (right + left) / 2;&lt;br /&gt;    m_sort(numbers, temp, left, mid);&lt;br /&gt;    m_sort(numbers, temp, mid+1, right);&lt;br /&gt;&lt;br /&gt;    merge(numbers, temp, left, mid+1, right);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void merge(int numbers[], int temp[], int left, int mid, int right)&lt;br /&gt;{&lt;br /&gt;  int i, left_end, num_elements, tmp_pos;&lt;br /&gt;&lt;br /&gt;  left_end = mid - 1;&lt;br /&gt;  tmp_pos = left;&lt;br /&gt;  num_elements = right - left + 1;&lt;br /&gt;&lt;br /&gt;  while ((left &amp;lt= left_end) &amp;&amp; (mid &amp;lt= right))&lt;br /&gt;  {&lt;br /&gt;    if (numbers[left] &amp;lt= numbers[mid])&lt;br /&gt;    {&lt;br /&gt;      temp[tmp_pos] = numbers[left];&lt;br /&gt;      tmp_pos = tmp_pos + 1;&lt;br /&gt;      left = left +1;&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;      temp[tmp_pos] = numbers[mid];&lt;br /&gt;      tmp_pos = tmp_pos + 1;&lt;br /&gt;      mid = mid + 1;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  while (left &amp;lt= left_end)&lt;br /&gt;  {&lt;br /&gt;    temp[tmp_pos] = numbers[left];&lt;br /&gt;    left = left + 1;&lt;br /&gt;    tmp_pos = tmp_pos + 1;&lt;br /&gt;  }&lt;br /&gt;  while (mid &amp;lt= right)&lt;br /&gt;  {&lt;br /&gt;    temp[tmp_pos] = numbers[mid];&lt;br /&gt;    mid = mid + 1;&lt;br /&gt;    tmp_pos = tmp_pos + 1;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  for (i=0; i &amp;lt= num_elements; i++)&lt;br /&gt;  {&lt;br /&gt;    numbers[right] = temp[right];&lt;br /&gt;    right = right - 1;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114576847241424118?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114576847241424118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114576847241424118' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114576847241424118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114576847241424118'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/04/merge-sort.html' title='Merge Sort'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114576833996347953</id><published>2006-04-22T21:58:00.000-07:00</published><updated>2006-04-22T21:59:00.016-07:00</updated><title type='text'>Insertion Sort</title><content type='html'>/** this is a program to implement Insertion sort&lt;br /&gt;V.S.Phanindra&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;Algorithm Analysis&lt;br /&gt;The insertion sort works just like its name suggests - it inserts each item into its proper place in the final &lt;br /&gt;list. The simplest implementation of this requires two list structures - the source list and the list into &lt;br /&gt;which sorted items are inserted. To save memory, most implementations use an in-place sort that works by &lt;br /&gt;moving the current item past the already sorted items and repeatedly swapping it with the preceding item &lt;br /&gt;until it is in place.&lt;br /&gt;Like the bubble sort, the insertion sort has a complexity of O(n2). Although it has the same complexity, &lt;br /&gt;the insertion sort is a little over twice as efficient as the bubble sort.&lt;br /&gt;&lt;br /&gt;Pros: Relatively simple and easy to implement.&lt;br /&gt;Cons: Inefficient for large lists.&lt;br /&gt;*/&lt;br /&gt;class InsertionSort &lt;br /&gt;{&lt;br /&gt; public static void main(String[] args) &lt;br /&gt; {&lt;br /&gt;  int a[]={2,1,4,6,8,9,-1,4,3,10};&lt;br /&gt;  int temp,j;&lt;br /&gt;&lt;br /&gt;  for(int i=0;i&amp;lta.length;i++)&lt;br /&gt;  {&lt;br /&gt;   int index=a[i];&lt;br /&gt;   j=i;&lt;br /&gt;   while((j&gt;0)&amp;&amp;(a[j-1]&gt;index))&lt;br /&gt;   {&lt;br /&gt;    a[j]=a[j-1];&lt;br /&gt;    j=j-1;&lt;br /&gt;   }&lt;br /&gt;   a[j]=index;&lt;br /&gt;  }  &lt;br /&gt;  for(int j1=0;j1&amp;lta.length;j1++)&lt;br /&gt;   System.out.println(a[j1]);&lt;br /&gt; }  &lt;br /&gt;   &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114576833996347953?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114576833996347953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114576833996347953' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114576833996347953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114576833996347953'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/04/insertion-sort.html' title='Insertion Sort'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114576827412249659</id><published>2006-04-22T21:56:00.000-07:00</published><updated>2006-04-22T21:57:54.173-07:00</updated><title type='text'>Selection Sort</title><content type='html'>/**&lt;br /&gt;The selection sort works by selecting the smallest unsorted item remaining in the list, and then swapping &lt;br /&gt;it with the item in the next position to be filled. The selection sort has a complexity of O(n2).&lt;br /&gt;&lt;br /&gt;It yields a 60% performance improvement over the bubble sort, but the insertion sort is over twice as fast as &lt;br /&gt;the bubble sort and is just as easy to implement as the selection sort. In short, there really isn't any reason &lt;br /&gt;to use the selection sort - use the insertion sort instead.&lt;br /&gt;&lt;br /&gt;If you really want to use the selection sort for some reason, try to avoid sorting lists of more than a 1000 items &lt;br /&gt;with it or repetitively sorting lists of more than a couple hundred items. &lt;br /&gt;&lt;br /&gt;Pros: Simple and easy to implement.&lt;br /&gt;Cons: Inefficient for large lists, so similar to the more efficient &lt;br /&gt;insertion sort that the insertion sort should be used in its place.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;class SelectionSort &lt;br /&gt;{&lt;br /&gt; public static void main(String[] args) &lt;br /&gt; {&lt;br /&gt;  int a[]={2,1,4,6,-1};&lt;br /&gt;  int j=0,temp=0;&lt;br /&gt;  for(int i=0;i&amp;lta.length-1;i++)&lt;br /&gt;  {&lt;br /&gt;   int min=i;&lt;br /&gt;   for(j=i+1;j&amp;lta.length;j++)&lt;br /&gt;   {&lt;br /&gt;    if(a[j]&amp;lta[min])&lt;br /&gt;     min=j;&lt;br /&gt;   }&lt;br /&gt;    temp=a[i];&lt;br /&gt;    a[i]=a[min];&lt;br /&gt;    a[min]=temp;&lt;br /&gt;  }&lt;br /&gt;  for(int i=0;i&amp;lta.length;i++)&lt;br /&gt;    System.out.println(a[i]);  &lt;br /&gt; }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114576827412249659?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114576827412249659/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114576827412249659' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114576827412249659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114576827412249659'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/04/selection-sort.html' title='Selection Sort'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114468024325392909</id><published>2006-04-10T07:43:00.000-07:00</published><updated>2006-04-10T07:44:08.883-07:00</updated><title type='text'>Program to Implement Quick Sort</title><content type='html'>/**&lt;br /&gt;The quick sort is an in-place, divide-and-conquer, massively recursive sort. The efficiency of the algorithm is majorly impacted by which element is choosen as the pivot point.The worst-case efficiency of the quick sort, O(n2), occurs when the list is sorted and the left-most element is chosen.*/&lt;br /&gt;&lt;br /&gt;Pros: Extremely fast.&lt;br /&gt;Cons: Very complex algorithm, massively recursive.&lt;br /&gt;&lt;br /&gt;#include &lt;stdlib.h&gt;&lt;br /&gt;#include &lt;stdio.h&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void quickSort(int numbers[], int array_size);&lt;br /&gt;void q_sort(int numbers[], int left, int right);&lt;br /&gt;&lt;br /&gt;int numbers[5];&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;  int i;&lt;br /&gt;&lt;br /&gt;  printf("Enter the numbers to be sorted");&lt;br /&gt;  for (i = 0; i &lt;5; i++)&lt;br /&gt; scanf("%d",&amp;numbers[i]);&lt;br /&gt;&lt;br /&gt;  //perform quick sort on array&lt;br /&gt;  quickSort(numbers, 5);&lt;br /&gt;&lt;br /&gt;  printf("List of Elements after Sorting.\n");&lt;br /&gt;  for (i = 0; i &lt; 5; i++)&lt;br /&gt;    printf("%i\n", numbers[i]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void quickSort(int numbers[], int array_size)&lt;br /&gt;{&lt;br /&gt;  q_sort(numbers, 0, array_size - 1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void q_sort(int numbers[], int left, int right)&lt;br /&gt;{&lt;br /&gt;  int pivot, l_hold, r_hold;&lt;br /&gt;  static int count=0; &lt;br /&gt;  count++;&lt;br /&gt;  l_hold = left;&lt;br /&gt;  r_hold = right;&lt;br /&gt;  pivot = numbers[left];&lt;br /&gt;  while (left &lt; right)&lt;br /&gt;  {&lt;br /&gt;    while ((numbers[right] &gt;= pivot) &amp;&amp; (left &lt; right))&lt;br /&gt;      right--;&lt;br /&gt;    if (left != right)&lt;br /&gt;    {&lt;br /&gt;      numbers[left] = numbers[right];&lt;br /&gt;      left++;&lt;br /&gt;    }&lt;br /&gt;    while ((numbers[left] &lt;= pivot) &amp;&amp; (left &lt; right))&lt;br /&gt;      left++;&lt;br /&gt;    if (left != right)&lt;br /&gt;    {&lt;br /&gt;      numbers[right] = numbers[left];&lt;br /&gt;      right--;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  numbers[left] = pivot;&lt;br /&gt;  pivot = left;&lt;br /&gt;  left = l_hold;&lt;br /&gt;  right = r_hold;&lt;br /&gt;  if (left &lt; pivot)&lt;br /&gt;    q_sort(numbers, left, pivot-1);&lt;br /&gt;  if (right &gt; pivot)&lt;br /&gt;    q_sort(numbers, pivot+1, right);&lt;br /&gt;  }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114468024325392909?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114468024325392909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114468024325392909' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114468024325392909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114468024325392909'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/04/program-to-implement-quick-sort.html' title='Program to Implement Quick Sort'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114467970067161545</id><published>2006-04-10T07:34:00.000-07:00</published><updated>2006-04-10T07:35:47.866-07:00</updated><title type='text'>Bubble Sort</title><content type='html'>/** This is a program to implement bubble sort&lt;br /&gt;Author : V.S.Phanindra&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;The bubble sort is the oldest and simplest sort in use. Unfortunately, it's also the slowest, it sort works by comparing each item in the list with the item next to it, and swapping them if required.&lt;br /&gt;&lt;br /&gt;Pros: Simplicity and ease of implementation.&lt;br /&gt;Cons: Horribly inefficient.&lt;br /&gt;&lt;br /&gt;class BubbleSort&lt;br /&gt;{&lt;br /&gt; public static void main(String[] args) &lt;br /&gt; {&lt;br /&gt;  int a[]={2,1,4,6,8,9,-1,4,3,2};&lt;br /&gt;  int temp;&lt;br /&gt;&lt;br /&gt;  System.out.println("This is the List of elements before Sorting:");&lt;br /&gt;  for(int k=0;k&amp;lt;a.length;k++)&lt;br /&gt;   System.out.println(a[k]);&lt;br /&gt;  for(int i=0;i&amp;lt;a.length;i++)&lt;br /&gt;  {&lt;br /&gt;   for(int j=i+1;j&amp;lt;a.length-1;j++)&lt;br /&gt;   {&lt;br /&gt;    if (a[j] &amp;lt; a[i])&lt;br /&gt;    {&lt;br /&gt;     temp = a[i];&lt;br /&gt;     a[i] = a[j];&lt;br /&gt;     a[j] = temp;&lt;br /&gt;    }&lt;br /&gt;   }                     } &lt;br /&gt;  System.out.println("This is the sorted List of Elements:");&lt;br /&gt;  for(int j=0;j&amp;lt;a.length;j++)&lt;br /&gt;   System.out.println(a[j]);&lt;br /&gt; }  &lt;br /&gt;   &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114467970067161545?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114467970067161545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114467970067161545' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114467970067161545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114467970067161545'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/04/bubble-sort.html' title='Bubble Sort'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114452328820395947</id><published>2006-04-08T12:07:00.000-07:00</published><updated>2006-04-08T12:11:16.250-07:00</updated><title type='text'>Program for print Ramanjan Numbers</title><content type='html'>/*Taking input as command line arguments and checks whether the numbers &lt;br /&gt; form Ramanjan number.*/&lt;br /&gt;&lt;br /&gt;/*Author:SivaPhanindra.Vemuri*/&lt;br /&gt;#include&lt;stdio.h&gt;&lt;br /&gt;main(int argc,char *argv[])&lt;br /&gt;{&lt;br /&gt; int l,m,n,p;&lt;br /&gt; if(argc!=5)&lt;br /&gt; {&lt;br /&gt;  printf("Wrong Number of arguments\n");&lt;br /&gt;  exit(0);&lt;br /&gt; }&lt;br /&gt; l=atoi(argv[1]); //loading the values of l,m,n,p from the&lt;br /&gt;    // comman line arguments&lt;br /&gt; m=atoi(argv[2]);  &lt;br /&gt; n=atoi(argv[3]);&lt;br /&gt; p=atoi(argv[4]);&lt;br /&gt; printf("%d\n%d\n%d\n%d\n",l,m,n,p);&lt;br /&gt; if(l!=m!=p!=n)&lt;br /&gt; { &lt;br /&gt;  if(cube(l)+cube(m)==cube(n)+cube(p))&lt;br /&gt;   printf("GIVEN NUMBERS FORM RAMANJAN SERIES\n");&lt;br /&gt;  else&lt;br /&gt;          printf("NUMBERS DOES'NT FORM RAMANJAN NUMBER\n");&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt;  printf("NUMBERS DOES'NT FORM RAMANJAN NUMBER\n");&lt;br /&gt;}&lt;br /&gt; int cube(int x)  //defining cube &lt;br /&gt; { &lt;br /&gt;  return(x*x*x);&lt;br /&gt; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114452328820395947?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114452328820395947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114452328820395947' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114452328820395947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114452328820395947'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/04/program-for-print-ramanjan-numbers.html' title='Program for print Ramanjan Numbers'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114438554356250369</id><published>2006-04-06T21:47:00.000-07:00</published><updated>2006-04-06T21:52:23.646-07:00</updated><title type='text'>Overriding in java</title><content type='html'>when a method in a subclass has the same name and type signature as a method in its superclass, then the method in the subclass is said to override the method in the superclass. When an overridden method is called from within a subclass, it will always refer to the version of that method defined by the subclass.&lt;br /&gt;&lt;br /&gt;sample program on overriding:&lt;br /&gt;&lt;br /&gt;class A {&lt;br /&gt;int i, j;&lt;br /&gt;A(int a, int b) {&lt;br /&gt;i = a;&lt;br /&gt;j = b;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void show() {&lt;br /&gt;System.out.println("i and j: " + i + " " + j);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class B extends A {&lt;br /&gt;int k;&lt;br /&gt;B(int a, int b, int c) {&lt;br /&gt;super(a, b);&lt;br /&gt;k = c;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void show() {&lt;br /&gt;System.out.println("k: " + k);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;class Override {&lt;br /&gt;public static void main(String args[]) {&lt;br /&gt;B subOb = new B(1, 2, 3);&lt;br /&gt;subOb.show(); // this calls show() in B class&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;What if I want to call show method in super class.....&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sample program on overriding:&lt;br /&gt;&lt;br /&gt;class A {&lt;br /&gt;int i, j;&lt;br /&gt;A(int a, int b) {&lt;br /&gt;i = a;&lt;br /&gt;j = b;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void show() {&lt;br /&gt;System.out.println("i and j: " + i + " " + j);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class B extends A {&lt;br /&gt;int k;&lt;br /&gt;B(int a, int b, int c) {&lt;br /&gt;super(a, b);&lt;br /&gt;k = c;&lt;br /&gt;}&lt;br /&gt;void show() {&lt;br /&gt;super.show(); // this calls A's show()&lt;br /&gt;System.out.println("k: " + k);&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114438554356250369?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114438554356250369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114438554356250369' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114438554356250369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114438554356250369'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/04/overriding-in-java.html' title='Overriding in java'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114438524289377878</id><published>2006-04-06T21:34:00.000-07:00</published><updated>2006-04-06T21:47:34.103-07:00</updated><title type='text'>What is overloading in java</title><content type='html'>In Java it is possible to define two or more methods within the same class that share the same name, as long as their parameter declarations are different. When this is the case,the methods are said to be overloaded, and the process is referred to as method&lt;br /&gt;overloading. Method overloading is one of the ways that Java implements polymorphism.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Sample program of overloading:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;class Overloading {&lt;br /&gt;void test() {&lt;br /&gt;System.out.println("No parameters");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void test(int a, int b) {&lt;br /&gt;System.out.println("a and b: " + a + " " + b);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void test(float a) {&lt;br /&gt;System.out.println("Inside test(double) a: " + a);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;class Overload {&lt;br /&gt;public static void main(String args[]) {&lt;br /&gt;Overloading ob = new Overloading();&lt;br /&gt;int i = 88;&lt;br /&gt;ob.test();&lt;br /&gt;ob.test(10, 20);&lt;br /&gt;ob.test(i); &lt;br /&gt;ob.test(123.2); &lt;br /&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114438524289377878?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114438524289377878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114438524289377878' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114438524289377878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114438524289377878'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/04/what-is-overloading-in-java.html' title='What is overloading in java'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114322604073347758</id><published>2006-03-24T10:45:00.000-08:00</published><updated>2006-03-24T10:48:40.853-08:00</updated><title type='text'>Program to reverse a string</title><content type='html'>/*This is a program to reverse a given string that is taken from keyboard as input*/&lt;br /&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#define length 20&lt;br /&gt;main(){&lt;br /&gt;  int a[length];&lt;br /&gt;  int c=getchar();&lt;br /&gt;  int i=0,k=0;&lt;br /&gt;  while((c!='\n'))&lt;br /&gt;  {&lt;br /&gt;   a[i]=c;&lt;br /&gt;   i++;&lt;br /&gt;   c=getchar();&lt;br /&gt;  }&lt;br /&gt;  for(k=i-1;k&amp;gt;=0;k--)&lt;br /&gt;   printf("%c",a[k]);&lt;br /&gt; &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114322604073347758?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114322604073347758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114322604073347758' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114322604073347758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114322604073347758'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/program-to-reverse-string.html' title='Program to reverse a string'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114234115624233490</id><published>2006-03-14T04:58:00.000-08:00</published><updated>2006-03-14T05:00:11.173-08:00</updated><title type='text'>XML Parser in Java</title><content type='html'>// Team 1&lt;br /&gt;// XML Parser&lt;br /&gt;&lt;br /&gt;package book;&lt;br /&gt;import java.io.File;&lt;br /&gt;import org.w3c.dom.Document;&lt;br /&gt;import org.w3c.dom.*;&lt;br /&gt;import java.util.*;&lt;br /&gt;&lt;br /&gt;import javax.xml.parsers.DocumentBuilderFactory;&lt;br /&gt;import javax.xml.parsers.DocumentBuilder;&lt;br /&gt;import org.xml.sax.SAXException;&lt;br /&gt;import org.xml.sax.SAXParseException; &lt;br /&gt;&lt;br /&gt;class XMLParser&lt;br /&gt;{&lt;br /&gt; public Hashtable getBooks()&lt;br /&gt; {&lt;br /&gt;  Hashtable listBooks= new Hashtable();;&lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;   DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();&lt;br /&gt;         DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();&lt;br /&gt;         Document doc = docBuilder.parse (new File("e:/input.xml"));&lt;br /&gt;&lt;br /&gt;    // normalize text representation&lt;br /&gt;         doc.getDocumentElement ().normalize ();&lt;br /&gt;   NodeList totallistBooks = doc.getElementsByTagName("books");&lt;br /&gt;         int totalBooks = totallistBooks.getLength();&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;         for(int s=0; s&amp;lt;totallistBooks.getLength() ; s++){&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                Node firstPersonNode = totallistBooks.item(s);&lt;br /&gt;                if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                    Element firstPersonElement = (Element)firstPersonNode;&lt;br /&gt;&lt;br /&gt;                    //-------&lt;br /&gt;                    NodeList firstNameList = firstPersonElement.getElementsByTagName("bookId");&lt;br /&gt;     Element firstNameElement = (Element)firstNameList.item(0);&lt;br /&gt;&lt;br /&gt;                    NodeList textFNList = firstNameElement.getChildNodes();&lt;br /&gt;                 &lt;br /&gt;                    NodeList lastNameList = firstPersonElement.getElementsByTagName("bookName");&lt;br /&gt;                    Element lastNameElement = (Element)lastNameList.item(0);&lt;br /&gt;&lt;br /&gt;                    NodeList textLNList = lastNameElement.getChildNodes();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     //inserting into hashtable key value pairs&lt;br /&gt;&lt;br /&gt;                   listBooks.put(((Node)textLNList.item(0)).getNodeValue().trim(),((Node)textFNList.item(0)).getNodeValue().trim());&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;                }//end of if clause&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            }//end of for loop with s var&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;  catch (SAXParseException err) &lt;br /&gt;  {&lt;br /&gt;   System.out.println ("** Parsing error" + ", line " + err.getLineNumber () + ", uri " + err.getSystemId ());&lt;br /&gt;   System.out.println(" " + err.getMessage ());&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;  catch (SAXException e) &lt;br /&gt;  {&lt;br /&gt;    Exception x = e.getException ();&lt;br /&gt;   ((x == null) ? e : x).printStackTrace ();&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;  catch (Throwable t) &lt;br /&gt;  {&lt;br /&gt;        t.printStackTrace ();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;  return listBooks;&lt;br /&gt; }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114234115624233490?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114234115624233490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114234115624233490' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114234115624233490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114234115624233490'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/xml-parser-in-java.html' title='XML Parser in Java'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114216767618514634</id><published>2006-03-12T04:43:00.000-08:00</published><updated>2006-03-12T04:47:56.423-08:00</updated><title type='text'>Algorithms Used in Garbage collection</title><content type='html'>Post-HotSpot JVM:&lt;br /&gt;The Exact VM (JVM 1.2.2) introduced exact garbage collection. Sun then improved the exact GC design in JVM 1.3 and renamed it generational GC. Java HotSpot VM 1.3.1's GC is fully accurate, guaranteeing that: &lt;br /&gt;&lt;br /&gt;1)You can reliably reclaim all inaccessible objects' memory&lt;br /&gt;2)You can relocate all objects to compact memory, eliminating object memory fragmentation&lt;br /&gt;&lt;br /&gt;Three types of collection algorithms:&lt;br /&gt;• Copy/scavenge collection&lt;br /&gt;• Mark-compact collection &lt;br /&gt;• Incremental (train) collection &lt;br /&gt;&lt;br /&gt;The HotSpot JVM provides three GC algorithms, each tuned for a specific type of collection within a specific generation. The copy collection quickly cleans up short-lived objects in the new generation heap. The mark-compact algorithm employs a slower, more robust technique to collect longer-lived objects in the old generation heap. The incremental algorithm attempts to improve old generation collection by performing robust GC while minimizing pauses. &lt;br /&gt;&lt;br /&gt;Copy/scavenge collection:&lt;br /&gt;Using the copy algorithm, the JVM reclaims most objects in the new generation object space simply by making small scavenges . Longer-lived objects are ultimately copied, or tenured, into the old object space. &lt;br /&gt;&lt;br /&gt;Mark-compact collection:&lt;br /&gt;As more objects become tenured, the old object space begins to reach maximum occupancy. The mark-compact algorithm, used to collect objects in the old object space, has different requirements than the copy collection algorithm used in the new object space. &lt;br /&gt;&lt;br /&gt;The mark-compact algorithm first scans all objects, marking all reachable objects. It then compacts all remaining gaps of dead objects. The mark-compact algorithm occupies more time than the copy collection algorithm; however, it requires less memory and eliminates memory fragmentation. &lt;br /&gt;&lt;br /&gt;Incremental (train) collection:&lt;br /&gt;The new generations copy/scavenge and the old generation mark-compact algorithms can't eliminate all JVM pauses. Such pauses are proportional to the number of live objects. To address the need for pause less GC, the Hotspot JVM also offers incremental, or train, collection. &lt;br /&gt;&lt;br /&gt;Incremental collection breaks up old object collection pauses into many tiny pauses even with large object areas. Instead of just a new and an old generation, this algorithm has a middle generation comprising many small spaces. There is some overhead associated with incremental collection; you might see as much as a 10-percent speed degradation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114216767618514634?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114216767618514634/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114216767618514634' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114216767618514634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114216767618514634'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/algorithms-used-in-garbage-collection.html' title='Algorithms Used in Garbage collection'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114209250240591444</id><published>2006-03-11T07:54:00.000-08:00</published><updated>2006-03-11T07:55:02.530-08:00</updated><title type='text'>Lower Case to Uppre Case Conversion</title><content type='html'>//PROGRAM FOR PRINTING CHARACTER IN UPPER CASE GIVEN THE CHARACTER IN LOWER CASE&lt;br /&gt;//AUTHOR:SIVAPHANINDRA.VEMURI&lt;br /&gt;&lt;br /&gt;import java.io.*;      /*IMPORTING THE EXISTING CLASSES*/&lt;br /&gt;class Task1d   /*CLASS NAMED Task1d*/&lt;br /&gt;{&lt;br /&gt; public static void main(String[] args)throws IOException /*MAIN FUNCTION WHICH &lt;br /&gt;          THROWS AN IOEXCEPTION IF SATISFIES THE CONDITION*/&lt;br /&gt; {&lt;br /&gt;  char c;       //FOR STORING THE READ CHARCATER FROM THE USER&lt;br /&gt;  BufferedReader br=new BufferedReader (new InputStreamReader(System.in));/*BUFFERED READER FOR TAKING THE INPUT FROM THE USER*/&lt;br /&gt;  System.out.println("Enter Character To Quit Press 'q'");&lt;br /&gt;  do&lt;br /&gt;  {&lt;br /&gt;   c=(char)br.read();   /*READ FUNCTION TO READ CHARACTER WITH "br" AS AN OBJECT OF BEFFEREDREADER*/&lt;br /&gt;   if(c==10||c==13)  /*TO ELIMINATE THE SPACE AND ENTER UNNECESSARY CHARACTERS*/ &lt;br /&gt;   {}&lt;br /&gt;   else if(c=='q')&lt;br /&gt;     return;&lt;br /&gt;   else&lt;br /&gt;    System.out.println("UPPER CASE IS:"+(char)(c-32));  /*CONVERTING THE GIVEN CHARACTER INTO UPPER CASE*/&lt;br /&gt;  }while(c!='q');  /*REPEAT UNTIL GIVEN CHARACTER IS NOT EQUAL TO 'q'*/&lt;br /&gt; } &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114209250240591444?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114209250240591444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114209250240591444' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114209250240591444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114209250240591444'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/lower-case-to-uppre-case-conversion.html' title='Lower Case to Uppre Case Conversion'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114209233741804734</id><published>2006-03-11T07:51:00.000-08:00</published><updated>2006-03-11T07:53:19.826-08:00</updated><title type='text'>PRINTING THE NON-PRIMES</title><content type='html'>//PROGRAM FOR PRINTING THE NON-PRIMES INTO A FILE&lt;br /&gt;//AUTHOR:SIVAPHANINDRA.VEMURI&lt;br /&gt;&lt;br /&gt;import java.io.*;              /*IMPORTING SECTION*/&lt;br /&gt;class Task1e1     /* DECLARING A CLASS NAMED Task1e1*/&lt;br /&gt;{&lt;br /&gt; public static void main(String args[])   /*MAIN FUNCTION*/&lt;br /&gt; {&lt;br /&gt;       FileOutputStream file_out=null; /* CREATING STREAMS FOR DIRECTING IT TO THE OUTPUT FILE*/ &lt;br /&gt;             PrintStream pno=null;&lt;br /&gt;       try{&lt;br /&gt;    file_out=new FileOutputStream("non-primes.txt",false); &lt;br /&gt;                pno = new PrintStream(file_out,true);&lt;br /&gt;      }catch(FileNotFoundException e){    /*  TO CATCH EXCEPTIONS */&lt;br /&gt;       System.out.println();&lt;br /&gt;       return;&lt;br /&gt;      }&lt;br /&gt;      catch(IOException e){    &lt;br /&gt;       System.out.println("IOEXCEPTION");&lt;br /&gt;       return;&lt;br /&gt;      }&lt;br /&gt;  int num=2;&lt;br /&gt;  do&lt;br /&gt;  {&lt;br /&gt;  for(int i=2;i &amp;lt;num;i++)&lt;br /&gt;  {&lt;br /&gt;   if((num%i)==0)    /*CHECKING FOR NON PRIMES*/&lt;br /&gt;   {&lt;br /&gt;    &lt;br /&gt;         pno.println(num);  /*FOR WRITING TO THE FILE */&lt;br /&gt;     pno.println();&lt;br /&gt;     break;&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  num++;&lt;br /&gt;  }while(num!=500);    /*TO PRINT ALL THE NON PRIMES BETWEEN 1-500*/&lt;br /&gt; }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114209233741804734?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114209233741804734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114209233741804734' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114209233741804734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114209233741804734'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/printing-non-primes.html' title='PRINTING THE NON-PRIMES'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114209223737662011</id><published>2006-03-11T07:49:00.000-08:00</published><updated>2006-03-11T07:50:37.643-08:00</updated><title type='text'>PRIME FACTORS OF ALL NON-PRIMES BELOW 500</title><content type='html'>/*TO PRINT THE PRIME FACTORS OF ALL NON-PRIMES BELOW 500*/&lt;br /&gt;/*AUTHOR:SIVAPHANINDRA.VEMURI*/&lt;br /&gt;&lt;br /&gt;import java.io.*;   /*IMPORTING SECTION*/&lt;br /&gt;class Task1e2    /* DECLARING A CLASS NAMED Task1e2*/&lt;br /&gt;{&lt;br /&gt; public static void main(String args[])throws IOException  /*MAIN METHOD THROWING IOEXCEPTION*/&lt;br /&gt; {&lt;br /&gt;  int i,j=0;&lt;br /&gt;  int a[]=new int [500];        /*ALLOCATING MEMORY FOR ARRAY A OF 500 SIZE*/&lt;br /&gt;  String fp;       /* CREATING AN OBJECT FOR STRING*/ &lt;br /&gt;  BufferedReader br=new BufferedReader (new FileReader("non-primes.txt")); &lt;br /&gt;  while((fp=br.readLine())!=null)&lt;br /&gt;  {&lt;br /&gt;   a[j]=Integer.parseInt(fp);&lt;br /&gt;   j++;&lt;br /&gt;   fp=br.readLine();&lt;br /&gt;  }&lt;br /&gt;  br.close();&lt;br /&gt;  PrintStream ps= new PrintStream(new FileOutputStream ("non-primes.txt"),true);  /*CREATING AN OBJECT FOR PRINT STRAM*/&lt;br /&gt;  for(i=0;i&lt;j;i++)   /*THIS IS FOR WRITING INTO THE FILE ALL THE PRIMEFACTORS*/&lt;br /&gt;  {&lt;br /&gt;   ps.print(a[i]+":");&lt;br /&gt;   int prmfact = 2;&lt;br /&gt;            while (a[i] &gt; 1)&lt;br /&gt;            {&lt;br /&gt;    if (a[i] % prmfact == 0)&lt;br /&gt;                {&lt;br /&gt;     ps.print(prmfact+"*");  /*PRINITING THE PRIMEFACTOR TO THE FILE*/&lt;br /&gt;                    a[i] = a[i] / prmfact;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;     prmfact = prmfact + 1;&lt;br /&gt;                }&lt;br /&gt;                if (prmfact * prmfact &gt; a[i])&lt;br /&gt;                {   &lt;br /&gt;     ps.print(a[i]+" "); &lt;br /&gt;     ps.println();&lt;br /&gt;     break;&lt;br /&gt;                }&lt;br /&gt;   } &lt;br /&gt;   ps.println();&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt; }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114209223737662011?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114209223737662011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114209223737662011' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114209223737662011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114209223737662011'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/prime-factors-of-all-non-primes-below.html' title='PRIME FACTORS OF ALL NON-PRIMES BELOW 500'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114199843827371426</id><published>2006-03-10T05:42:00.000-08:00</published><updated>2006-03-10T05:47:25.500-08:00</updated><title type='text'>What is Garbage Collection &amp; Why is Garbage Collection?</title><content type='html'>The name garbage collection implies that objects no longer needed by the program are "garbage" and can be thrown away. When an object is no longer referenced by the program, the heap space it occupies can be recycled so that the space is made available for new objects. The garbage collector must somehow determine which objects are no longer referenced by the program and make available the heap space occupied by such unreferenced objects. In the process of freeing unreferenced objects, the garbage collector must run any finalizers of objects being freed. &lt;br /&gt;&lt;br /&gt;In addition to freeing unreferenced objects, a garbage collector may also combat heap fragmentation. Heap fragmentation occurs through the course of normal program execution. New objects are allocated, and unreferenced objects are freed such that free portions of heap memory are left in between portions occupied by live objects. Requests to allocate new objects may have to be filled by extending the size of the heap even though there is enough total unused space in the existing heap. This will happen if there is not enough contiguous free heap space available into which the new object will fit. &lt;br /&gt;&lt;br /&gt;Garbage collection relieves you from the burden of freeing allocated memory. Knowing when to explicitly free allocated memory can be very tricky. Giving this job to the Java virtual machine has several advantages. First, it can make you more productive. When programming in non-garbage-collected languages you can spend many hours on elusive memory problem. A second advantage of garbage collection is that it helps ensure program integrity. Garbage collection is an important part of Java's security strategy. Java programmers are unable to accidentally (or purposely) crash the Java virtual machine by incorrectly freeing memory. &lt;br /&gt;&lt;br /&gt;A potential disadvantage of a garbage-collected heap is that it adds an overhead that can affect program performance. The Java virtual machine has to keep track of which objects are being referenced by the executing program, and finalize and free unreferenced objects on the fly. This activity will likely require more CPU time than would have been required if the program explicitly freed unnecessary memory. In addition, programmers in a garbage-collected environment have less control over the scheduling of CPU time devoted to freeing objects that are no longer needed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114199843827371426?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114199843827371426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114199843827371426' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114199843827371426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114199843827371426'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/what-is-garbage-collection-why-is.html' title='What is Garbage Collection &amp; Why is Garbage Collection?'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114199624470788803</id><published>2006-03-10T05:04:00.000-08:00</published><updated>2006-03-10T05:10:45.136-08:00</updated><title type='text'>Public static void main (String args[])</title><content type='html'>The public keyword is an access specifier, which allows the programmer to control the visibility of class members. When a class member is preceded by public, then that member may be accessed by code outside the class in which it is declared.In this case, main( ) must be declared as public, since it must be called by code outside of its class when the program is started. The keyword static allows main( ) to be called without having to instantiate a particular instance of the class. This is necessary since main( ) is called by the Java interpreter before any objects are made. The keyword void simply tells the compiler that main( ) does not return a value. As you will see, methods may also return values. &lt;br /&gt;As stated, main( ) is the method called when a Java application begins. Keep in mind that Java is case-sensitive. Thus, Main is different from main. It is important to understand that the Java compiler will compile classes that do not contain a main( ) method. But the Java interpreter has no way to run these classes. So, if you had typed Main instead of main, the compiler would still compile your program. However, the Java interpreter would report an error because it would be unable to find the main( ) method. &lt;br /&gt;Any information that you need to pass to a method is received by variables specified within the set of parentheses that follow the name of the method. These variables are called parameters. If there are no parameters required for a given method, you still need to include the empty parentheses. In main( ), there is only one parameter, albeit a complicated one. String args[ ] declares a parameter named args, which is an array of instances of the class String. Objects of type String store character strings. In this case, args receives any command-line arguments present when the program is executed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114199624470788803?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114199624470788803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114199624470788803' title='41 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114199624470788803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114199624470788803'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/public-static-void-main-string-args.html' title='Public static void main (String args[])'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>41</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114192991244802877</id><published>2006-03-09T10:44:00.000-08:00</published><updated>2006-03-09T10:45:13.206-08:00</updated><title type='text'>Delete and Update values in MySql Using Java</title><content type='html'>/* A Sample program to Delete and Update values from and to a table Using Java*/&lt;br /&gt;&lt;br /&gt;import java.sql.*;&lt;br /&gt;import java.util.*;&lt;br /&gt;&lt;br /&gt;public class DeleteUpdate&lt;br /&gt;{&lt;br /&gt;  public static void main(String args[]) {&lt;br /&gt;    try {&lt;br /&gt;      /* Test loading driver */&lt;br /&gt;&lt;br /&gt;      Hashtable members = new Hashtable();&lt;br /&gt;&lt;br /&gt;        // Load the JDBC driver&lt;br /&gt;     Class.forName("com.mysql.jdbc.Driver");&lt;br /&gt;  &lt;br /&gt;     // Establish a connection&lt;br /&gt;     String url = "jdbc:mysql://localhost/test";  //here "test" is the name of the database in use&lt;br /&gt;     Connection connection = DriverManager.getConnection( url, "root", "kris" );  //root and password is name&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;         /* Create a statement*/&lt;br /&gt;        Statement statement = connection.createStatement();&lt;br /&gt;   &lt;br /&gt;  &lt;br /&gt;    /*process to insert values into database test where phani is the tablename*/&lt;br /&gt;&lt;br /&gt;             &lt;br /&gt;            String Delete = "delete from phani where name like '" + "Vemuri" + "'";&lt;br /&gt;   int j = statement.executeUpdate(Delete);&lt;br /&gt;   &lt;br /&gt;    System.out.println("--------Values Deleted from table Successfully----------"+j);&lt;br /&gt;&lt;br /&gt;   /*process to Update values in your database test where phani is the tablename */&lt;br /&gt;&lt;br /&gt;   String Update = "update phani set name = '" + "aaaaaaa" +"' where ID = '" + "1000" +"'";&lt;br /&gt;   int updateCount = statement.executeUpdate(Update);&lt;br /&gt;&lt;br /&gt;    System.out.println("--------Values Updated Successfully----------"+ updateCount);&lt;br /&gt;&lt;br /&gt;        &lt;br /&gt;&lt;br /&gt;    }    &lt;br /&gt;    catch( Exception x ) {&lt;br /&gt;      x.printStackTrace();&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* Prerequisites you need to have Mysql installed in your system with a data base named "test"&lt;br /&gt;   and with username "root" and password "name"*/&lt;br /&gt;/* Javac DeleteUpdate.java  */&lt;br /&gt;/* Java DeleteUpdate */&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114192991244802877?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114192991244802877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114192991244802877' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114192991244802877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114192991244802877'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/delete-and-update-values-in-mysql.html' title='Delete and Update values in MySql Using Java'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114190665096425693</id><published>2006-03-09T04:12:00.001-08:00</published><updated>2006-03-09T04:17:55.186-08:00</updated><title type='text'>Insert values into table Using Java</title><content type='html'>/* A Sample program to Insert values to a table Using Java*/&lt;br /&gt;&lt;br /&gt;import java.sql.*;&lt;br /&gt;import java.util.*;&lt;br /&gt;&lt;br /&gt;public class Insert&lt;br /&gt;{&lt;br /&gt;  public static void main(String args[]) {&lt;br /&gt;    try {&lt;br /&gt;      /* Test loading driver */&lt;br /&gt;&lt;br /&gt;      Hashtable members = new Hashtable();&lt;br /&gt;&lt;br /&gt;        // Load the JDBC driver&lt;br /&gt;     Class.forName("com.mysql.jdbc.Driver");&lt;br /&gt;  &lt;br /&gt;     // Establish a connection&lt;br /&gt;     String url = "jdbc:mysql://localhost/test";  //here "test" is the name of the database in use&lt;br /&gt;     Connection connection = DriverManager.getConnection( url, "root", "kris" );  //root and password is name&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;         /* Create a statement*/&lt;br /&gt;        Statement statement = connection.createStatement();&lt;br /&gt;   &lt;br /&gt;  &lt;br /&gt;  /* Execute a statement for selecting values from database here details is the tables name in database "test"*/&lt;br /&gt;        String name[]={"Siva","Phanindra","Vemuri"};&lt;br /&gt;        String ID[]={"1000","9000","1232"};&lt;br /&gt;&lt;br /&gt;    /*process to insert values into database*/&lt;br /&gt;        &lt;br /&gt;          for(int i=0;i&amp;lt;name.length;i++){&lt;br /&gt;            String INSERT = "insert into phani(name,ID)values ('" + name[i] + "','" +&lt;br /&gt;                ID[i] + "')";&lt;br /&gt;            int j = statement.executeUpdate(INSERT);&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;    System.out.println("--------Values Inserted into table Successfully----------");&lt;br /&gt;        &lt;br /&gt;&lt;br /&gt;    }    &lt;br /&gt;    catch( Exception x ) {&lt;br /&gt;      x.printStackTrace();&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* Prerequisites you need to have Mysql installed in your system with a data base named "test"&lt;br /&gt;   and with username "root" and password "name"*/&lt;br /&gt;/* Javac Insert.java  */&lt;br /&gt;/* Java Insert */&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114190665096425693?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114190665096425693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114190665096425693' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114190665096425693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114190665096425693'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/insert-values-into-table-using-java.html' title='Insert values into table Using Java'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114181097353546682</id><published>2006-03-08T01:41:00.000-08:00</published><updated>2006-03-08T01:42:53.546-08:00</updated><title type='text'>Program to Retrive values from Mysql Using Java</title><content type='html'>/* A Sample program to connect to Mysql Using Java*/&lt;br /&gt;&lt;br /&gt;import java.sql.*;&lt;br /&gt;&lt;br /&gt;public class Test&lt;br /&gt;{&lt;br /&gt;  public static void main(String args[]) {&lt;br /&gt;    try {&lt;br /&gt;      /* Test loading driver */&lt;br /&gt;&lt;br /&gt;   Hashtable members = new Hashtable();&lt;br /&gt;      String driver = "com.mysql.jdbc.Driver";&lt;br /&gt;      System.out.println( "-----&gt;loading driver:-------&gt;" );&lt;br /&gt;      Class.forName( driver );&lt;br /&gt;&lt;br /&gt;  /* Test the connection Here test is the name of the database you want to connect to*/&lt;br /&gt;      String url = "jdbc:mysql://localhost/test";&lt;br /&gt;&lt;br /&gt;   /*root is the user name and kris is the password of MYSql*/&lt;br /&gt;      DriverManager.getConnection( url, "root", "kris" );&lt;br /&gt;   System.out.println("connection established");&lt;br /&gt;&lt;br /&gt;         /* Create a statement*/&lt;br /&gt;      Statement statement = connection.createStatement();&lt;br /&gt;   &lt;br /&gt;  &lt;br /&gt;  /* Execute a statement for selecting values from database here details is the tables name in database "test"*/&lt;br /&gt;        ResultSet resultSet = statement.executeQuery("select * from details");&lt;br /&gt;        while (resultSet.next()){&lt;br /&gt;        members.put(resultSet.getString(1),resultSet.getString(2));&lt;br /&gt;        System.out.println(resultSet.getString(1) + "\t" +&lt;br /&gt;        resultSet.getString(2) );&lt;br /&gt;      &lt;br /&gt;    }&lt;br /&gt;    catch( Exception x ) {&lt;br /&gt;      x.printStackTrace();&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114181097353546682?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114181097353546682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114181097353546682' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114181097353546682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114181097353546682'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/program-to-retrive-values-from-mysql.html' title='Program to Retrive values from Mysql Using Java'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114172923437048340</id><published>2006-03-07T02:57:00.002-08:00</published><updated>2006-03-07T03:00:34.376-08:00</updated><title type='text'>Java Mysql Connectivity</title><content type='html'>Download mysql-connector-java-3.1.12.zip from www.mysql.com Extart the files and copy "mysql-connector-java-3.0.8-stable-bin.jar" and in C:\j2sdk1.4.2_04\jre\lib create a folder with name "java-mysql-connector" and place the jar file in it, next you need to set the Classpath You should also add the complete path to this JAR file in your CLASSPATH environment variable. In case if you don't know how to do that, go to Start -&gt; Settings -&gt; Control Panel -&gt; System -&gt; Advanced (tab) -&gt; Environment Variables. Double-click 'CLASSPATH' if it is already listed there or click 'New' to create one with the name of 'CLASSPATH'. If you already had a 'CLASSPATH environment variable listed, simply type in (or paste) the complete path including file name in the window that opens up *at the end of* existing CLASSPATH values. If you are creating a new 'CLASSPATH' environment variable then simple enter '.;' and then append the complete path to Connector/J's JAR file.Note: The CLASSPATH variable contains a list of semi-colon separated folders and JAR files where JVM will search for Java class files. You should always separate paths with semi-colon (;) so that JVM can understand where one path ends and next one begins. Also keep in mind that in CLASSPATH variable paths, the first path is always '.' (single dot) which means current folder, so that JVM starts the search for Java class files from the current folder.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114172923437048340?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114172923437048340/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114172923437048340' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114172923437048340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114172923437048340'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/java-mysql-connectivity_114172923437048340.html' title='Java Mysql Connectivity'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114164882821878898</id><published>2006-03-06T04:37:00.000-08:00</published><updated>2006-03-06T04:40:28.226-08:00</updated><title type='text'>Program to Delete Files in a Given Directory</title><content type='html'>import java.io.File;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Program to delete files in a directory.&lt;br /&gt; * &lt;br /&gt; * @author vsphanindra&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; public class DeleteDirectory {&lt;br /&gt;&lt;br /&gt; public static void function (File dir,String a){&lt;br /&gt; String[] info = dir.list();&lt;br /&gt;    for (int i = 0; i &lt; info.length; i++) {&lt;br /&gt;    File n = new File(a + dir.separator + info[i]);&lt;br /&gt;    if (!n.isFile())&lt;br /&gt;       continue;&lt;br /&gt; System.out.println("Removed:" + n.getPath());&lt;br /&gt;    if (!n.delete())&lt;br /&gt;        System.err.println("Couldn't remove:" + n.getPath());&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt; public static void main(String[] argv) {&lt;br /&gt;    if (argv.length != 1) { &lt;br /&gt;      System.err.println("Enter in this format :::-------- java Empty DeleteDirectory and its path ");&lt;br /&gt;      System.exit(1);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    File dir = new File(argv[0]);&lt;br /&gt;    if (!dir.exists()) {&lt;br /&gt;      System.out.println(argv[0] + " Directory does not exist");&lt;br /&gt;      return;&lt;br /&gt;    }&lt;br /&gt; function(dir,argv[0]);&lt;br /&gt;   &lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* javac DeleteDirectory.java  */&lt;br /&gt;/* java DeleteDirectory pathofthedirectory */&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114164882821878898?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114164882821878898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114164882821878898' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114164882821878898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114164882821878898'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/program-to-delete-files-in-given.html' title='Program to Delete Files in a Given Directory'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114156449376762637</id><published>2006-03-05T05:14:00.000-08:00</published><updated>2006-03-05T05:14:53.780-08:00</updated><title type='text'>Program to Write to a file</title><content type='html'>/* * FileOutputDemo * Using PrintStream classes * */ &lt;br /&gt;&lt;br /&gt;/* This program writes a given string to file named output.txt */&lt;br /&gt; import java.io.*; &lt;br /&gt; class FileOutputDemo &lt;br /&gt;  { &lt;br /&gt;   public static void main(String args[]) &lt;br /&gt;    { &lt;br /&gt;    String a = "phanindra";&lt;br /&gt;    try {&lt;br /&gt;         FileOutputStream out = new FileOutputStream("output.txt"); &lt;br /&gt;                PrintStream p = new PrintStream( out );&lt;br /&gt;         p.println (a); &lt;br /&gt;      p.close(); &lt;br /&gt;     } &lt;br /&gt;     catch (Exception e) { &lt;br /&gt;      System.err.println ("Error writing to file"); &lt;br /&gt;     } &lt;br /&gt;    } &lt;br /&gt;  }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114156449376762637?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114156449376762637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114156449376762637' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114156449376762637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114156449376762637'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/program-to-write-to-file.html' title='Program to Write to a file'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23422423.post-114149806427713717</id><published>2006-03-04T10:47:00.000-08:00</published><updated>2006-03-04T10:47:44.283-08:00</updated><title type='text'>Program to Rename Files in a given Directory</title><content type='html'>import java.io.File;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Program to rename the files in a given Floder&lt;br /&gt; * &lt;br /&gt; * @author vsphanindra&lt;br /&gt; */&lt;br /&gt;public class Rename {&lt;br /&gt;  public static void main(String[] argv) {&lt;br /&gt;    if (argv.length != 1) { // no progname in argv[0]&lt;br /&gt;      System.err.println("usage: Empty dirname");&lt;br /&gt;      System.exit(1);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    File dir = new File(argv[0]);&lt;br /&gt;    if (!dir.exists()) {&lt;br /&gt;      System.out.println(argv[0] + " does not exist");&lt;br /&gt;      return;&lt;br /&gt;    }&lt;br /&gt;    String[] info = dir.list();&lt;br /&gt;    for (int i = 0; i &lt; info.length; i++) {&lt;br /&gt;    File n = new File(argv[0] + dir.separator + info[i]);&lt;br /&gt;   /* this is the place where we will change the name of the file's &lt;br /&gt;   with the extension we wishin the given folder*/&lt;br /&gt;   String str= argv[0] + dir.separator+"Scene"+i+".jpg";&lt;br /&gt;   n.renameTo(new File(str));&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* javac Rename.java  */&lt;br /&gt;&lt;br /&gt;/*java Rename "absolute path of the directory which you want to change the file name in" */&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23422423-114149806427713717?l=conceptoftheday.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://conceptoftheday.blogspot.com/feeds/114149806427713717/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23422423&amp;postID=114149806427713717' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114149806427713717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23422423/posts/default/114149806427713717'/><link rel='alternate' type='text/html' href='http://conceptoftheday.blogspot.com/2006/03/program-to-rename-files-in-given.html' title='Program to Rename Files in a given Directory'/><author><name>phanindra</name><uri>http://www.blogger.com/profile/04188443643821638887</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
