<?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-6660638602196740640</id><updated>2012-01-13T09:00:41.584-08:00</updated><category term='Java Program to show AsciiArray class'/><category term='classes in java'/><category term='FileTyper class in java'/><category term='Program using NullOutputStream Class in java'/><category term='Program for RandomInputStream Class in Java'/><category term='FileCopier Class in java'/><category term='Java Basics'/><category term='StreamPrinter Class in Java'/><category term='Program to Print ASCII values in Java'/><category term='Java Assignments'/><category term='aniket gadekar'/><category term='Java Script'/><category term='StreamCopier class in Java'/><category term='Java Projects'/><category term='FileDumper Class in java'/><title type='text'>Java Tutor...</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default?start-index=101&amp;max-results=100'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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>187</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6660638602196740640.post-3535418659223436038</id><published>2012-01-13T09:00:00.001-08:00</published><updated>2012-01-13T09:00:41.595-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FileDumper Class in java'/><title type='text'>FileDumper Class in java</title><content type='html'>FileDumper Class in java&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;i&lt;span style="font-family: courier new; font-weight: bold;"&gt;mport java.io.*; import com.elharo.io.*;  public class FileDumper {    public static final int ASC = 0;   public static final int DEC = 1;   public static final int HEX = 2;    public static void main(String[] args) {      if (args.length &amp;lt; 1) {       System.err.println("Usage: java FileDumper [-ahd] file1 file2...");       return;     }      int firstArg = 0;     int mode = ASC;      if (args[0].startsWith("-")) {       firstArg = 1;       if (args[0].equals("-h")) mode = HEX;       else if (args[0].equals("-d")) mode = DEC;     }      for (int i = firstArg; i &amp;lt; args.length; i++) {       try {         if (mode == ASC) dumpAscii(args[i]);         else if (mode == HEX) dumpHex(args[i]);         else if (mode == DEC) dumpDecimal(args[i]);          }         catch (IOException ex) {         System.err.println("Error reading from " + args[i] + ": "           + ex.getMessage());       }        if (i &amp;lt; args.length-1) {  // more files to dump         System.out.println("\r\n--------------------------------------\r\n");       }     }   }    public static void dumpAscii(String filename) throws IOException {      FileInputStream fin = null;     try {       fin = new FileInputStream(filename);       StreamCopier.copy(fin, System.out);     }     finally {       if (fin != null) fin.close();     }   }    public static void dumpDecimal(String filename) throws IOException {      FileInputStream fin = null;     byte[] buffer = new byte[16];     boolean end = false;      try {       fin = new FileInputStream(filename);       while (!end) {         int bytesRead = 0;         while (bytesRead &amp;lt; buffer.length) {           int r = fin.read(buffer, bytesRead, buffer.length - bytesRead);           if (r == -1) {             end = true;             break;           }           bytesRead += r;         }         for (int i = 0; i &amp;lt; bytesRead; i++) {           int dec = buffer[i];           if (dec &amp;lt; 0) dec = 256 + dec;           if (dec &amp;lt; 10) System.out.print("00" + dec + " ");           else if (dec &amp;lt; 100) System.out.print("0" + dec + " ");           else System.out.print(dec + " ");         }         System.out.println();       }     }     finally {       if (fin != null) fin.close();     }   }    public static void dumpHex(String filename) throws IOException {      FileInputStream fin = null;     byte[] buffer = new byte[24];     boolean end = false;      try {       fin = new FileInputStream(filename);       while (!end) {         int bytesRead = 0;         while (bytesRead &amp;lt; buffer.length) {           int r = fin.read(buffer, bytesRead, buffer.length - bytesRead);           if (r == -1) {             end = true;             break;           }           bytesRead += r;         }         for (int i = 0; i &amp;lt; bytesRead; i++) {           int hex = buffer[i];           if (hex &amp;lt; 0) hex = 256 + hex;           if (hex &amp;gt;= 16) System.out.print(Integer.toHexString(hex) + " ");           else System.out.print("0" + Integer.toHexString(hex) + " ");         }         System.out.println();       }     }     finally {       if (fin != null) fin.close();     }   } }&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-3535418659223436038?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3535418659223436038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2012/01/filedumper-class-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3535418659223436038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3535418659223436038'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2012/01/filedumper-class-in-java.html' title='FileDumper Class in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3115460399404792124</id><published>2012-01-13T08:59:00.002-08:00</published><updated>2012-01-13T09:00:08.265-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FileCopier Class in java'/><title type='text'>FileCopier Class in java</title><content type='html'>FileCopier Class in java&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;i&lt;span style="font-family: courier new; font-weight: bold;"&gt;mport java.io.*; import com.elharo.io.*;  public class FileCopier {    public static void main(String[] args) {      if (args.length != 2) {       System.err.println("Usage: java FileCopier infile outfile");     }     try {       copy(args[0], args[1]);     }     catch (IOException ex) {       System.err.println(ex);     }   }    public static void copy(String inFile, String outFile)     throws IOException {      FileInputStream  fin = null;     FileOutputStream fout = null;          try {       fin  = new FileInputStream(inFile);       fout = new FileOutputStream(outFile);       StreamCopier.copy(fin, fout);     }     finally {       try {         if (fin != null) fin.close();       }       catch (IOException ex) {       }       try {         if (fout != null) fout.close();        }       catch (IOException ex) { }     }   } }&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-3115460399404792124?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3115460399404792124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2012/01/filecopier-class-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3115460399404792124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3115460399404792124'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2012/01/filecopier-class-in-java.html' title='FileCopier Class in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-6013537042400454931</id><published>2012-01-13T08:59:00.001-08:00</published><updated>2012-01-13T08:59:32.220-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FileTyper class in java'/><title type='text'>FileTyper class in java</title><content type='html'>FileTyper class in java&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-weight: bold;"&gt;import java.io.*; import com.elharo.io.*;  public class FileTyper {    public static void main(String[] args) throws IOException {     if (args.length != 1) {       System.err.println("Usage: java FileTyper filename");       return;     }     typeFile(args[0]);   }    public static void typeFile(String filename) throws IOException {     FileInputStream fin = new FileInputStream(filename);     try {         StreamCopier.copy(fin, System.out);     }     finally {       fin.close();     }   } }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-6013537042400454931?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/6013537042400454931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2012/01/filetyper-class-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6013537042400454931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6013537042400454931'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2012/01/filetyper-class-in-java.html' title='FileTyper class in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-172242351239931643</id><published>2012-01-13T08:58:00.001-08:00</published><updated>2012-01-13T08:58:55.692-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Program using NullOutputStream Class in java'/><title type='text'>Program using NullOutputStream Class in java</title><content type='html'>Program using NullOutputStream Class in java&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;package com.elharo.io;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class NullOutputStream extends OutputStream {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private boolean closed = false;  &lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public void write(int b) throws IOException {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    if (closed) throw new IOException("Write to closed stream");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public void write(byte[] data, int offset, int length) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;   throws IOException {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    if (data == null) throw new NullPointerException("data is null");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    if (closed) throw new IOException("Write to closed stream");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public void close() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    closed = true;   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-172242351239931643?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/172242351239931643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2012/01/program-using-nulloutputstream-class-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/172242351239931643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/172242351239931643'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2012/01/program-using-nulloutputstream-class-in.html' title='Program using NullOutputStream Class in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-7863080123989711192</id><published>2012-01-13T08:56:00.000-08:00</published><updated>2012-01-13T08:57:26.515-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Program to show AsciiArray class'/><title type='text'>Java Program to show AsciiArray class</title><content type='html'>Java Program to show AsciiArray class&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;public class AsciiArray {&lt;br /&gt;&lt;br /&gt;  public static void main(String[] args) {&lt;br /&gt;    &lt;br /&gt;    byte[] b = new byte[(127-31)*2];&lt;br /&gt;    int index = 0;&lt;br /&gt;    for (int i = 32; i &lt; 127; i++) {&lt;br /&gt;      b[index++] = (byte) i;&lt;br /&gt;      // Break line after every eight characters.&lt;br /&gt;      if (i % 8 == 7) b[index++] = (byte) '\n';&lt;br /&gt;      else b[index++] = (byte) '\t';&lt;br /&gt;    }&lt;br /&gt;    b[index++] = (byte) '\n';&lt;br /&gt;    try {&lt;br /&gt;      System.out.write(b);&lt;br /&gt;    }&lt;br /&gt;    catch (IOException ex) { &lt;br /&gt;      System.err.println(ex);&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/6660638602196740640-7863080123989711192?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/7863080123989711192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2012/01/java-program-to-show-asciiarray-class.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/7863080123989711192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/7863080123989711192'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2012/01/java-program-to-show-asciiarray-class.html' title='Java Program to show AsciiArray class'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8934734534504817198</id><published>2012-01-13T08:55:00.000-08:00</published><updated>2012-01-13T08:56:27.832-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='StreamCopier class in Java'/><title type='text'>StreamCopier class in Java</title><content type='html'>StreamCopier class in Java&lt;br /&gt;&lt;br /&gt;package com.elharo.io;&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;public class StreamCopier {&lt;br /&gt;&lt;br /&gt;  public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt;    try {&lt;br /&gt;      copy(System.in, System.out);&lt;br /&gt;    }&lt;br /&gt;    catch (IOException ex) {&lt;br /&gt;      System.err.println(ex);&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public static void copy(InputStream in, OutputStream out) &lt;br /&gt;   throws IOException {&lt;br /&gt;    &lt;br /&gt;    byte[] buffer = new byte[1024];&lt;br /&gt;    while (true) {&lt;br /&gt;      int bytesRead = in.read(buffer);&lt;br /&gt;      if (bytesRead == -1) break;&lt;br /&gt;      out.write(buffer, 0, bytesRead);&lt;br /&gt;    }&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/6660638602196740640-8934734534504817198?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8934734534504817198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2012/01/streamcopier-class-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8934734534504817198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8934734534504817198'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2012/01/streamcopier-class-in-java.html' title='StreamCopier class in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3299499210805888185</id><published>2012-01-13T08:53:00.000-08:00</published><updated>2012-01-13T08:54:21.117-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Program for RandomInputStream Class in Java'/><title type='text'>Program for RandomInputStream Class in Java</title><content type='html'>Program for RandomInputStream Class in Java&lt;br /&gt;&lt;br /&gt;package com.elharo.io;&lt;br /&gt;&lt;br /&gt;import java.util.*;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;public class RandomInputStream extends InputStream {&lt;br /&gt;&lt;br /&gt;  private Random generator = new Random();&lt;br /&gt;  private boolean closed = false;&lt;br /&gt;&lt;br /&gt;  public int read() throws IOException {&lt;br /&gt;    checkOpen();&lt;br /&gt;    int result = generator.nextInt() % 256;&lt;br /&gt;    if (result &lt; 0) result = -result;&lt;br /&gt;    return result;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public int read(byte[] data, int offset, int length) throws IOException {&lt;br /&gt;    checkOpen();&lt;br /&gt;    byte[] temp = new byte[length];&lt;br /&gt;    generator.nextBytes(temp);&lt;br /&gt;    System.arraycopy(temp, 0, data, offset, length);&lt;br /&gt;    return length;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public int read(byte[] data) throws IOException {&lt;br /&gt;    checkOpen();&lt;br /&gt;    generator.nextBytes(data);&lt;br /&gt;    return data.length;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public long skip(long bytesToSkip) throws IOException {&lt;br /&gt;    checkOpen();&lt;br /&gt;    // It's all random so skipping has no effect.&lt;br /&gt;    return bytesToSkip;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  public void close() {&lt;br /&gt;      this.closed = true;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  private void checkOpen() throws IOException {&lt;br /&gt;      if (closed) throw new IOException("Input stream closed");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public int available() {&lt;br /&gt;    // Limited only by available memory and the size of an array.&lt;br /&gt;    return Integer.MAX_VALUE;&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/6660638602196740640-3299499210805888185?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3299499210805888185/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2012/01/program-for-randominputstream-class-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3299499210805888185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3299499210805888185'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2012/01/program-for-randominputstream-class-in.html' title='Program for RandomInputStream Class in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-6062734350595223994</id><published>2012-01-13T08:51:00.000-08:00</published><updated>2012-01-13T08:53:09.795-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='StreamPrinter Class in Java'/><title type='text'>StreamPrinter Class in Java</title><content type='html'>StreamPrinter Class in Java&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;public class StreamPrinter {&lt;br /&gt;&lt;br /&gt;  public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt;    try {&lt;br /&gt;      while (true) {&lt;br /&gt;        int datum = System.in.read();&lt;br /&gt;        if (datum  == -1) break;&lt;br /&gt;        System.out.println(datum);&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    catch (IOException ex) {&lt;br /&gt;      System.err.println("Couldn't read from System.in!");&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/6660638602196740640-6062734350595223994?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/6062734350595223994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2012/01/streamprinter-class-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6062734350595223994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6062734350595223994'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2012/01/streamprinter-class-in-java.html' title='StreamPrinter Class in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1174307804093340486</id><published>2012-01-13T08:50:00.000-08:00</published><updated>2012-01-13T08:51:06.889-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Program to Print ASCII values in Java'/><title type='text'>Program to Print ASCII values in Java</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Program to Print ASCII values in Java &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;&lt;br /&gt;public class AsciiChart &lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;  public static void main(String[] args) {&lt;br /&gt;    &lt;br /&gt;    for (int i = 32; i &lt; 127; i++) {&lt;br /&gt;      System.out.write(i);&lt;br /&gt;      // break line after every eight characters.&lt;br /&gt;      if (i % 8 == 7) System.out.write('\n');&lt;br /&gt;      else System.out.write('\t');&lt;br /&gt;    }&lt;br /&gt;    System.out.write('\n');&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/6660638602196740640-1174307804093340486?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1174307804093340486/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2012/01/program-to-print-ascii-values-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1174307804093340486'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1174307804093340486'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2012/01/program-to-print-ascii-values-in-java.html' title='Program to Print ASCII values in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-9028297776024595193</id><published>2011-05-08T05:38:00.000-07:00</published><updated>2011-05-08T05:39:41.996-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Creating Threads in Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class ThreadDemo{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public static void main(String args[]){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        Thread t1= new Thread();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        t1=Thread.currentThread();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        System.out.println("Thread Name : "+t1.getName());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        System.out.println("Thread Priority : "+t1.getPriority());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        System.out.println("Thread is Alive : "+t1.isAlive());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        System.out.println("Threa is Daemon : "+t1.isDaemon());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        t1.setName("Avinash");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        t1.setPriority(9);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        System.out.println("Thread Name : "+t1.getName());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        System.out.println("Thread Priority : "+t1.getPriority());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        try{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            for(int i=1;i&amp;lt;=5;i++){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                for(int j=1;j&amp;lt;=i;j++){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    System.out.print(" "+j);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    Thread.sleep(200);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                System.out.println();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                Thread.sleep(1000);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }catch(InterruptedException ex){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                ex.printStackTrace();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-9028297776024595193?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/9028297776024595193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/05/creating-threads-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/9028297776024595193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/9028297776024595193'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/05/creating-threads-in-java.html' title='Creating Threads in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-5520073297580198102</id><published>2011-05-08T05:37:00.002-07:00</published><updated>2011-05-08T05:38:47.934-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Creating Menu in JAVA with GUI Interface</title><content type='html'>Creating Menu in JAVA with GUI Interface&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;public class MenuDemo extends Frame{&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    private MenuBar mb;&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    private Menu m1,m2,m3,m4,m5;&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    private MenuItem ne,op,sa,ss,ps,pr,ex;&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    private MenuItem un,cp,ct,pa,del,fn,sl;&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    private MenuItem font,ww;&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    private MenuItem st,tl;&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    private MenuItem ht,an;&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    public MenuDemo(){&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        mb=new MenuBar();&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        m1=new Menu("File");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        m2=new Menu("Edit");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        m3=new Menu("Format");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        m4=new Menu("View");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        m5=new Menu("Help");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        ne=new MenuItem("New");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        op=new MenuItem("Open...");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        sa=new MenuItem("Save");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        ss=new MenuItem("Save As...");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        ps=new MenuItem("Page Setup...");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        pr=new MenuItem("Print...");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        ex=new MenuItem("Exit");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        un=new MenuItem("Undo");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        cp=new MenuItem("Copy");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        ct=new MenuItem("Cut");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        ps=new MenuItem("Paste");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        del=new MenuItem("Delete");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        fn=new MenuItem("Find...");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        sl=new MenuItem("Select All");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        st=new MenuItem("Status Bar");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        tl=new MenuItem("ToolBar");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        ht=new MenuItem("Help Topics...");&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        an=new MenuItem("About NotePad...");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        setMenuBar(mb);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        mb.add(m1);&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        mb.add(m2);&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        mb.add(m3);&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        mb.add(m4);&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        mb.add(m5);&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        setBounds(45,45,500,400);&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        setLayout(null);&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;        setVisible(true);&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    public static void main(String args[]){&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    new MenuDemo();&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style=" font-weight: bold;font-family:courier new;" &gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-5520073297580198102?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/5520073297580198102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/05/creating-menu-in-java-with-gui.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5520073297580198102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5520073297580198102'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/05/creating-menu-in-java-with-gui.html' title='Creating Menu in JAVA with GUI Interface'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-2555484281378599990</id><published>2011-05-08T05:37:00.001-07:00</published><updated>2011-05-08T05:37:40.091-07:00</updated><title type='text'>Creating GUI List in Java Listdemo</title><content type='html'>&lt;span style="font-family: courier new;"&gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;public class Listdemo extends Frame&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    List Demo=new List(5,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    public Listdemo(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            setLayout(null);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            setBounds(50,50,400,400);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            setVisible(true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    public void initcomp()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    {        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Demo.add("red");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Demo.setBounds(50,50,100,100);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Demo.setVisible(true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Demo.add("green");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Demo.add("blue");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            add(Demo);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Demo.addActionListener(new ActionListener(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                public void actionPerformed(ActionEvent ae){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    String s1=Demo.getSelectedItem();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    if(s1=="red"){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                        setBackground(Color.red);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    else if(s1=="green"){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                                            setBackground(Color.green);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    else if(s1=="blue"){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                            setBackground(Color.blue);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            });&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    public static void main(String args[]){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        new Listdemo();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        Listdemo l1=new Listdemo();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        l1.initcomp();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-2555484281378599990?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/2555484281378599990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/05/creating-gui-list-in-java-listdemo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2555484281378599990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2555484281378599990'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/05/creating-gui-list-in-java-listdemo.html' title='Creating GUI List in Java Listdemo'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8243910737520397155</id><published>2011-05-08T05:36:00.001-07:00</published><updated>2011-05-08T05:36:51.513-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Two Listener Example In Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class TwoListener implements MouseMotionListener,MouseListener{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    private Frame f;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    private TextField tf;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public TwoListener(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        f=new Frame("Two Listener Example");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        tf=new TextField(30);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void launchFrame(){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        Label label=new Label("Click and drag the mouse");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        f.add(label,BorderLayout.NORTH);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        f.add(tf,BorderLayout.SOUTH);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        f.addMouseMotionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        f.addMouseListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        f.setSize(300,200);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        f.setVisible(true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void mouseDragged(MouseEvent e){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String s="Mouse dragging : X ="+e.getX()+"Y = "+e.getY();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        tf.setText(s);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void mouseEntered(MouseEvent e){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String s="The Mouse Entered";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        tf.setText(s);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void mouseExited(MouseEvent e){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String s="The mouse has Left the Building";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        tf.setText(s);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void mouseMoved(MouseEvent e){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void mousePressed(MouseEvent e){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void mouseClicked(MouseEvent e){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void mouseReleased(MouseEvent e){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public static void main(String args[]){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        TwoListener two=new TwoListener();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        two.launchFrame();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-8243910737520397155?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8243910737520397155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/05/two-listener-example-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8243910737520397155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8243910737520397155'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/05/two-listener-example-in-java.html' title='Two Listener Example In Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1844125767663748752</id><published>2011-05-08T04:15:00.000-07:00</published><updated>2011-05-08T05:36:19.767-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><title type='text'>KeyboardInput Example In Java</title><content type='html'>import java.io.*;&lt;br /&gt;public class KeyboardInput{&lt;br /&gt;    public static void main(String args[]){&lt;br /&gt;        String s;&lt;br /&gt;        InputStreamReader ir=new InputStreamReader(System.in);&lt;br /&gt;        BufferedReader in =new BufferedReader(ir);&lt;br /&gt;        System.out.println("Unix : Type ctrl-d to exit."+"\n Windows :ctrl-z to exit .");&lt;br /&gt;        try{&lt;br /&gt;            s=in.readLine();&lt;br /&gt;            while(s!=null){&lt;br /&gt;                System.out.println("Read : "+s);&lt;br /&gt;                s=in.readLine();&lt;br /&gt;            }&lt;br /&gt;            in.close();&lt;br /&gt;        }catch(IOException ex){&lt;br /&gt;        ex.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/6660638602196740640-1844125767663748752?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1844125767663748752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/05/keyboardinput-example-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1844125767663748752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1844125767663748752'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/05/keyboardinput-example-in-java.html' title='KeyboardInput Example In Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8910659358588439692</id><published>2011-05-08T04:14:00.001-07:00</published><updated>2011-05-08T04:14:40.240-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>ButtonHandler Example in Java</title><content type='html'>&lt;span style="font-family: courier new;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;public class ButtonHandler implements ActionListener{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    public void actionPerformed(ActionEvent ae){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        System.out.println("Action Performed");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        System.out.println("Button's command is : "+ae.getActionCommand());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-8910659358588439692?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8910659358588439692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/05/buttonhandler-example-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8910659358588439692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8910659358588439692'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/05/buttonhandler-example-in-java.html' title='ButtonHandler Example in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-5141876645240645612</id><published>2011-04-14T09:02:00.000-07:00</published><updated>2011-04-14T09:03:02.506-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>What trivial change can Louis make to his code for smaller that will disable tail recursion in Java?</title><content type='html'>&lt;pre style="font-family: courier new;"&gt;1 ]=&amp;gt; (louis-sort test-list &amp;lt;)&lt;br /&gt;&lt;br /&gt;;The object (), passed as an argument to safe-car, is not a pair.&lt;br /&gt;;To continue, call RESTART with an option number:&lt;br /&gt;; (RESTART 1) =&amp;gt; Return to read-eval-print level 1.&lt;br /&gt;&lt;br /&gt;2 error&amp;gt; (debug)&lt;br /&gt;&lt;br /&gt;There are more than 50 subproblems on the stack.&lt;br /&gt;&lt;br /&gt;Subproblem level: 0 (this is the lowest subproblem level)&lt;br /&gt;Expression (from stack):&lt;br /&gt;   (predicate (car list) ###)&lt;br /&gt;subproblem being executed (marked by ###):&lt;br /&gt;   (cadr list)&lt;br /&gt;Environment created by the procedure: SMALLEST&lt;br /&gt;&lt;br /&gt;applied to: ((0) #[arity-dispatched-procedure 39])&lt;br /&gt;The execution history for this subproblem contains 1 reduction.&lt;br /&gt;You are now in the debugger.  Type q to quit, ? for commands.&lt;br /&gt;&lt;br /&gt;3 debug&amp;gt; H&lt;br /&gt;H&lt;br /&gt;SL#  Procedure-name          Expression&lt;br /&gt;&lt;br /&gt;0    smallest                (predicate (car list) (cadr list))&lt;br /&gt;1    smallest                (if (predicate (car list) (cadr list)) (smalle ...&lt;br /&gt;2    smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;3    smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;4    smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;5    smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;6    smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;7    smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;8    smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;9    smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;10   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;11   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;12   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;13   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;14   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;15   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;16   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;17   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;18   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;19   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;20   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;21   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;22   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;23   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;24   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;25   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;26   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;27   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;28   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;29   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;30   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;31   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;32   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;33   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;34   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;35   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;36   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;37   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;38   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;39   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;40   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;41   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;42   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;43   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;44   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;45   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;46   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;47   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;48   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;49   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;50   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;51   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;52   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;53   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;54   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;55   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;56   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;57   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;58   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;59   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;60   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;61   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;62   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;63   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;64   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;65   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;66   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;67   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;68   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;69   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;70   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;71   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;72   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;73   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;74   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;75   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;76   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;77   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;78   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;79   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;80   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;81   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;82   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;83   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;84   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;85   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;86   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;87   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;88   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;89   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;90   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;91   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;92   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;93   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;94   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;95   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;96   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;97   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;98   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;99   smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;100  smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;101  smallest                (let ((answer (if (predicate (car list) (cadr  ...&lt;br /&gt;102  do-loop                 (cons (smallest remainder predicate) (quote ()))&lt;br /&gt;103  do-loop                 (append answer (cons (smallest remainder predi ...&lt;br /&gt;104  do-loop                 (do-loop (cdr remainder) (append answer (cons  ...&lt;br /&gt;105  %repl-eval              (let ((value (hook/repl-eval s-expression envi ...&lt;br /&gt;106  %repl-eval/write        (hook/repl-write (%repl-eval s-expression envi ...&lt;br /&gt;107  do-loop                 (begin (if (queue-empty? queue) (let ((environ ...&lt;br /&gt;108  loop                    (loop (bind-abort-restart cmdl (lambda () (der ...&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/6660638602196740640-5141876645240645612?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/5141876645240645612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/what-trivial-change-can-louis-make-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5141876645240645612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5141876645240645612'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/what-trivial-change-can-louis-make-to.html' title='What trivial change can Louis make to his code for smaller that will disable tail recursion in Java?'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3561804976016263814</id><published>2011-04-14T09:01:00.000-07:00</published><updated>2011-04-14T09:02:27.017-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>program that returns 1 if run on a any tail-recursive implementation of a language, but returns 0 if run on a any non tail-recursive implementation of</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt;program that returns 1 if run on &lt;/span&gt;&lt;strike style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt;a&lt;/strike&gt;&lt;span style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); font-weight: bold; font-family: courier new;"&gt;any&lt;/span&gt;&lt;span style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt; tail-recursive implementation &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); font-weight: bold; font-family: courier new;"&gt;of a language&lt;/span&gt;&lt;span style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt;, but returns 0 if run on &lt;/span&gt;&lt;strike style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt;a&lt;/strike&gt;&lt;span style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); font-weight: bold; font-family: courier new;"&gt;any&lt;/span&gt;&lt;span style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt; non tail-recursive implementation &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); font-weight: bold; font-family: courier new;"&gt;of that same language&lt;/span&gt;&lt;span style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt;.  &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 0, 0);"&gt;&lt;span style="font-weight: bold; font-family: courier new; color: rgb(0, 0, 0);"&gt;The  goal is not to find a program and language implementation pair that  exhibit the behavior, but to design a program that can correctly infer  whether on not any supplied language implementation supports tail  recursion by examining its own behavior.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 0, 0);"&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre style="font-weight: bold;"&gt;(define (smallest list predicate)&lt;br /&gt; ;; Returns the smallest element of list.&lt;br /&gt; (if (null? list)&lt;br /&gt;     #f&lt;br /&gt;     (if (predicate (car list) (cadr list))&lt;br /&gt;         (smallest (cons (car list) (cddr list)) predicate)&lt;br /&gt;         (smallest (cdr list) predicate))))&lt;br /&gt;&lt;br /&gt;(define (louis-sort list predicate)&lt;br /&gt; (do ((remainder list (cdr remainder))&lt;br /&gt;      (answer '() (append answer (cons (smallest remainder predicate) '()))))&lt;br /&gt;     ((null? remainder) answer)))&lt;br /&gt;&lt;br /&gt;(define test-list&lt;br /&gt; (do ((i 0 (+ i 1))&lt;br /&gt;      (answer '() (cons i answer)))&lt;br /&gt;     ((&amp;gt;= i 100) answer)))&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/6660638602196740640-3561804976016263814?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3561804976016263814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-that-returns-1-if-run-on-any.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3561804976016263814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3561804976016263814'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-that-returns-1-if-run-on-any.html' title='program that returns 1 if run on a any tail-recursive implementation of a language, but returns 0 if run on a any non tail-recursive implementation of'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-5504962483676367788</id><published>2011-04-14T09:00:00.000-07:00</published><updated>2011-04-14T09:01:42.447-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>program that crashes or doesn't return if run on a any tail-recursive implementation of a language, but returns 0 if run on a any non tail-recursive</title><content type='html'>&lt;div style="text-align: justify; color: rgb(0, 0, 0);"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;program that &lt;/span&gt;&lt;i style="font-family: courier new; font-weight: bold;"&gt;crashes&lt;/i&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; or &lt;/span&gt;&lt;i style="font-family: courier new; font-weight: bold;"&gt;doesn't return&lt;/i&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; if run on &lt;/span&gt;&lt;strike style="font-family: courier new; font-weight: bold;"&gt;a&lt;/strike&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: courier new; font-weight: bold;"&gt;any&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; tail-recursive implementation &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: courier new; font-weight: bold;"&gt;of a language&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;, but returns 0 if run on &lt;/span&gt;&lt;strike style="font-family: courier new; font-weight: bold;"&gt;a&lt;/strike&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: courier new; font-weight: bold;"&gt;any&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; non tail-recursive implementation &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: courier new; font-weight: bold;"&gt;of that same language&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;.  &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: courier new; font-weight: bold;"&gt;The  goal is not to find a program and language implementation pair that  exhibit the behavior, but to design a program that can correctly infer  that any supplied implementation does not support tail recursion (this  is a weaker condition because we do not require that the program  correctly infer support of tail recursion, but only lack of support).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre style="font-weight: bold;"&gt;(define (smallest list predicate)&lt;br /&gt; ;; Returns the smallest element of list.&lt;br /&gt; (if (null? list)&lt;br /&gt;     #f&lt;br /&gt;     (if (predicate (car list) (cadr list))&lt;br /&gt;         (smallest (cons (car list) (cddr list)) predicate)&lt;br /&gt;         (smallest (cdr list) predicate))))&lt;br /&gt;&lt;br /&gt;(define (louis-sort list predicate)&lt;br /&gt; (do ((remainder list (cdr remainder))&lt;br /&gt;      (answer '() (append answer (cons (smallest remainder predicate) '()))))&lt;br /&gt;     ((null? remainder) answer)))&lt;br /&gt;&lt;br /&gt;(define test-list&lt;br /&gt; (do ((i 0 (+ i 1))&lt;br /&gt;      (answer '() (cons i answer)))&lt;br /&gt;     ((&amp;gt;= i 100) answer)))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-5504962483676367788?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/5504962483676367788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-that-crashes-or-doesnt-return.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5504962483676367788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5504962483676367788'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-that-crashes-or-doesnt-return.html' title='program that crashes or doesn&apos;t return if run on a any tail-recursive implementation of a language, but returns 0 if run on a any non tail-recursive'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3736913711605990943</id><published>2011-04-13T06:47:00.000-07:00</published><updated>2011-04-13T06:48:06.484-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to show the use of Labeled Break Statement in Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;publicclass JAVA_034&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    publicstaticvoid main(String[] args)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       int nValues=50;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       System.out.println("The Prime Numbers from 1 to 50 are : ");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       OuterLoop:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       for(int i=1;i&amp;lt;=nValues;i++)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          for(int j=2;j&lt;/span&gt;&lt;i;j++) style="font-family: courier new; font-weight: bold;"&gt;&lt;br /&gt;         {&lt;br /&gt;            if((i%j)==0)&lt;br /&gt;               break OuterLoop;&lt;br /&gt;         }&lt;br /&gt;&lt;br /&gt;         System.out.println(i);&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      System.out.println("The rest of the Loop iterations were skipped as 4 is not a Prime Number");&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/i;j++)&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-3736913711605990943?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3736913711605990943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-show-use-of-labeled-break.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3736913711605990943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3736913711605990943'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-show-use-of-labeled-break.html' title='Program to show the use of Labeled Break Statement in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8417878895266990506</id><published>2011-04-12T00:57:00.002-07:00</published><updated>2011-04-12T00:58:16.336-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to sort the contents of an array using Bubble Sort in Java</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;publicclass JAVA_037&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    publicstaticvoid main(String[] args)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       int[] array={10,-1,28,13,44,5,36,97,-18,11};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       System.out.println(" The contents of the Array in original order are :");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       for(int i=0;i&lt;array.length;i++)&gt;&lt;/array.length;i++)&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          System.out.println("\t\t\t\t\t Array[" + i + "] = " + array[i]);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       for(int j=0;j&amp;lt;(array.length-1);j++)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          for(int k=0;k&amp;lt;(array.length-1);k++)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;             if(array[k]&amp;gt;array[(k+1)])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;             {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                int temp=array[k];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                array[k]=array[(k+1)];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                array[(k+1)]=temp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;             }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       System.out.println("\n The contents of the Array after sorting are :");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       for(int l=0;l&lt;array.length;l++)&gt;&lt;/array.length;l++)&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          System.out.println("\t\t\t\t\t Array[" + l + "] = " + array[l]);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-8417878895266990506?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8417878895266990506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-sort-contents-of-array-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8417878895266990506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8417878895266990506'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-sort-contents-of-array-using.html' title='Program to sort the contents of an array using Bubble Sort in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-763750202694178314</id><published>2011-04-12T00:57:00.001-07:00</published><updated>2011-04-12T00:57:38.501-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to search an element in an array using Linear Search in Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;publicclass JAVA_038&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    publicstaticvoid main(String[] args)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       int[] array={10,-1,28,13,44,5,36,97,-18,11};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       System.out.println(" The contents of the Array are :");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       for(int i=0;i&lt;array.length;i++)&gt;&lt;/array.length;i++)&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          System.out.println("\t\t\t\t\t Array[" + i + "] = " + array[i]);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       int search_element=44;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       int find_index=-1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       for(int j=0;j&amp;lt;(array.length-1);j++)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          if(array[j]==search_element)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;             find_index=j;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;             break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       if(find_index!=-1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          System.out.println(" The search element is : " + search_element);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          System.out.println(" It is found in the array at position : " + find_index);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          System.out.println("\n The search element is not found in the array.");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; }&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-763750202694178314?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/763750202694178314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-search-element-in-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/763750202694178314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/763750202694178314'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-search-element-in-array.html' title='Program to search an element in an array using Linear Search in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-6550067778879965513</id><published>2011-04-12T00:56:00.001-07:00</published><updated>2011-04-12T00:56:58.317-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to declare, initialize and print an array of characters in Java</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;" id="ctl00_CC_lblExample"&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; JAVA_039&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; main(String[] args)&lt;br /&gt;   {&lt;br /&gt;      &lt;span class="kwrd"&gt;char&lt;/span&gt;[] Vowels={&lt;span class="str"&gt;'a'&lt;/span&gt;,&lt;span class="str"&gt;'e'&lt;/span&gt;,&lt;span class="str"&gt;'i'&lt;/span&gt;,&lt;span class="str"&gt;'o'&lt;/span&gt;,&lt;span class="str"&gt;'u'&lt;/span&gt;};&lt;br /&gt;&lt;br /&gt;      System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;" The contents of the Character Array - 2Vowels are :"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;for&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt; i=0;i&lt;vowels.length;i++)&gt;&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"\t\t\t\t\t Vowels["&lt;/span&gt; + i + &lt;span class="str"&gt;"] = "&lt;/span&gt; + Vowels[i]);&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/vowels.length;i++)&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-6550067778879965513?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/6550067778879965513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-declare-initialize-and-print_12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6550067778879965513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6550067778879965513'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-declare-initialize-and-print_12.html' title='Program to declare, initialize and print an array of characters in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-4902265153089823889</id><published>2011-04-12T00:55:00.000-07:00</published><updated>2011-04-12T00:56:07.431-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to declare, initialize and print a 2D array of integers in Java</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;" id="ctl00_CC_lblExample"&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; JAVA_040&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; main(String[] args)&lt;br /&gt;   {&lt;br /&gt;      &lt;span class="kwrd"&gt;int&lt;/span&gt;[][] array={ {10,-1,28,13,44} , {5,36,97,-18,11} };&lt;br /&gt;&lt;br /&gt;      System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"The contents of the 2D Array are : \n"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;for&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt; i=0;i&lt;array.length;i++)&gt;&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"Dimension # "&lt;/span&gt; + (i+1));&lt;br /&gt;&lt;br /&gt;         &lt;span class="kwrd"&gt;for&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt; j=0;j&lt;array[i].length;j++)&gt;&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"\t Array["&lt;/span&gt; + i + &lt;span class="str"&gt;"]["&lt;/span&gt; + j + &lt;span class="str"&gt;"] = "&lt;/span&gt; + array[i][j]);&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/array[i].length;j++)&gt;&lt;/array.length;i++)&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-4902265153089823889?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/4902265153089823889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-declare-initialize-and-print.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4902265153089823889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4902265153089823889'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-declare-initialize-and-print.html' title='Program to declare, initialize and print a 2D array of integers in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1886585109987984899</id><published>2011-04-12T00:54:00.002-07:00</published><updated>2011-04-12T00:55:43.903-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Multi dimensional array declare initialize  and display multi dimensional array in Java</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-family: verdana;" id="ctl00_CC_lblExample"&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;// Declaration of allocating memory to multi dimensional array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;int iarr[][]  = new int[2][3];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;// Initializing elements&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;iarr[0][0] = 1;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;iarr[0][1] = 2;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;iarr[0][2] = 3;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;iarr[1][0] = 4;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;iarr[1][1] = 5;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;iarr[1][2] = 6;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;//Display array elements&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;System.out.println(iarr[0][0]); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;System.out.println(iarr[0][1]); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;System.out.println(iarr[0][2]); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;System.out.println(iarr[1][0]); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;System.out.println(iarr[1][1]); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;System.out.println(iarr[1][2]); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 255);"&gt;// &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 255);"&gt;Or Use for loop to display elements&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt; for (int i = 0; i &amp;lt; iarr.length; i = i + 1) &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;       for(int j=0; j &amp;lt; iarr[i].length; j = j + 1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;      {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;             System.out.print(iarr[i][j]);  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;             System.out.print(" ");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;       }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt; }&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-1886585109987984899?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1886585109987984899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/multi-dimensional-array-declare.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1886585109987984899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1886585109987984899'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/multi-dimensional-array-declare.html' title='Multi dimensional array declare initialize  and display multi dimensional array in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-2368641081070100576</id><published>2011-04-12T00:54:00.001-07:00</published><updated>2011-04-12T00:54:52.075-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to show an example of using a Static Nested Class in Java</title><content type='html'>&lt;span id="ctl00_CC_lblExample"&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;public&lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;class&lt;/span&gt;&lt;span style="font-size:130%;"&gt; JAVA_071&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;public&lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;static&lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;void&lt;/span&gt;&lt;span style="font-size:130%;"&gt; main(String[] args)&lt;br /&gt;  {&lt;br /&gt;     System.&lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;out&lt;/span&gt;&lt;span style="font-size:130%;"&gt;.println(&lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;new&lt;/span&gt;&lt;span style="font-size:130%;"&gt; MagicHat(&lt;/span&gt;&lt;span class="str"  style="font-size:130%;"&gt;"Gray Topper"&lt;/span&gt;&lt;span style="font-size:130%;"&gt;));&lt;br /&gt;     System.&lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;out&lt;/span&gt;&lt;span style="font-size:130%;"&gt;.println(&lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;new&lt;/span&gt;&lt;span style="font-size:130%;"&gt; MagicHat(&lt;/span&gt;&lt;span class="str"  style="font-size:130%;"&gt;"Black Topper"&lt;/span&gt;&lt;span style="font-size:130%;"&gt;));&lt;br /&gt;     System.&lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;out&lt;/span&gt;&lt;span style="font-size:130%;"&gt;.println(&lt;/span&gt;&lt;span class="kwrd"  style="font-size:130%;"&gt;new&lt;/span&gt;&lt;span style="font-size:130%;"&gt; MagicHat(&lt;/span&gt;&lt;span class="str"  style="font-size:130%;"&gt;"Baseball Topper"&lt;/span&gt;&lt;span style="font-size:130%;"&gt;));&lt;br /&gt;  }&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-2368641081070100576?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/2368641081070100576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-show-example-of-using-static.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2368641081070100576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2368641081070100576'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/program-to-show-example-of-using-static.html' title='Program to show an example of using a Static Nested Class in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1662810983122503627</id><published>2011-04-12T00:52:00.000-07:00</published><updated>2011-04-12T00:53:34.483-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>One dimensional array shows how to declare initialize  and display an array.</title><content type='html'>&lt;span style="font-family: courier new;" id="ctl00_CC_lblExample"&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;// &lt;b&gt;Declaration of allocating memory to an array&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;int iarr[]  = new int[3];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;// &lt;b&gt;Initializing elements&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;iarr[0] = 1;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;iarr[1] = 2;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;iarr[2] = 3;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;//&lt;b&gt;Display array elements&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;System.out.println(iarr[0]); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;System.out.println(iarr[1]); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;System.out.println(iarr[2]); &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;// &lt;b&gt;Or Use for loop to display elements&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt; for (int i = 0; i &amp;lt; iarr.length; i = i + 1) &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;       System.out.print(iarr[i]);  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt;       System.out.print(" ");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000ff;"&gt; }&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-1662810983122503627?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1662810983122503627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/one-dimensional-array-shows-how-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1662810983122503627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1662810983122503627'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/one-dimensional-array-shows-how-to.html' title='One dimensional array shows how to declare initialize  and display an array.'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8528379665901350579</id><published>2011-04-12T00:51:00.000-07:00</published><updated>2011-04-12T00:52:38.820-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Corba program of date operations in Java</title><content type='html'>&lt;span id="ctl00_CC_lblExample"&gt;&lt;pre class="csharpcode"&gt;module GetDateModule&lt;br /&gt;{&lt;br /&gt;   &lt;span class="kwrd"&gt;interface&lt;/span&gt; GetDate&lt;br /&gt;   {&lt;br /&gt;       &lt;span class="kwrd"&gt;string&lt;/span&gt; get_date();&lt;br /&gt;       &lt;span class="kwrd"&gt;long&lt;/span&gt;&lt;span class="kwrd"&gt;long&lt;/span&gt; get_time();&lt;br /&gt;   };&lt;br /&gt;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;// GetDateImpl&lt;/span&gt;&lt;span class="rem"&gt;// Contains the implementation of the methods defined in the IDL file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;import GetDateModule.GetDatePOA;&lt;br /&gt;import java.lang.String;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; GetDateImpl extends GetDatePOA&lt;br /&gt;{&lt;br /&gt;   Date dt=&lt;span class="kwrd"&gt;new&lt;/span&gt; Date();&lt;br /&gt;      &lt;br /&gt;   GetDateImpl()&lt;br /&gt;   {&lt;br /&gt;       super();&lt;br /&gt;       System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"Encriptor Object Created"&lt;/span&gt;);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; String get_date()&lt;br /&gt;   {&lt;br /&gt;       String time=dt.toString();&lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; (time);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt;&lt;span class="kwrd"&gt;long&lt;/span&gt; get_time()&lt;br /&gt;   {&lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt;(dt.getTime());   &lt;br /&gt;   }   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;// Server&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;import GetDateModule.GetDate;&lt;br /&gt;import org.omg.CosNaming.*;&lt;br /&gt;import org.omg.CosNaming.NamingContextPackage.*;&lt;br /&gt;import org.omg.CORBA.*;&lt;br /&gt;import org.omg.PortableServer.*;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; GetDateServer&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; main(String[] args)&lt;br /&gt;   {&lt;br /&gt;       &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;br /&gt;       {&lt;br /&gt;           &lt;span class="rem"&gt;// initialize the ORB&lt;/span&gt;&lt;br /&gt;           org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;           &lt;span class="rem"&gt;// initialize the BOA/POA&lt;/span&gt;&lt;br /&gt;           POA rootPOA = POAHelper.narrow(orb.resolve_initial_references(&lt;span class="str"&gt;"RootPOA"&lt;/span&gt;));&lt;br /&gt;           rootPOA.the_POAManager().activate();&lt;br /&gt;&lt;br /&gt;           &lt;span class="rem"&gt;// creating the GetDate object&lt;/span&gt;&lt;br /&gt;           GetDateImpl GetDate = &lt;span class="kwrd"&gt;new&lt;/span&gt; GetDateImpl();&lt;br /&gt;          &lt;br /&gt;           &lt;span class="rem"&gt;// get the object reference from the servant class&lt;/span&gt;&lt;br /&gt;           org.omg.CORBA.Object &lt;span class="kwrd"&gt;ref&lt;/span&gt; = rootPOA.servant_to_reference(GetDate);&lt;br /&gt;&lt;br /&gt;           System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"Step1"&lt;/span&gt;);&lt;br /&gt;           GetDate h_ref = GetDateModule.GetDateHelper.narrow(&lt;span class="kwrd"&gt;ref&lt;/span&gt;);&lt;br /&gt;           System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"Step2"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;           org.omg.CORBA.Object objRef =orb.resolve_initial_references(&lt;span class="str"&gt;"NameService"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;           System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"Step3"&lt;/span&gt;);&lt;br /&gt;           NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);&lt;br /&gt;           System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"Step4"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;           String name = &lt;span class="str"&gt;"GetDate"&lt;/span&gt;;&lt;br /&gt;           NameComponent path[] = ncRef.to_name(name);&lt;br /&gt;           ncRef.rebind(path,h_ref);&lt;br /&gt;&lt;br /&gt;           System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"GetDate Server reading and waiting...."&lt;/span&gt;);&lt;br /&gt;           orb.run();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;       &lt;span class="kwrd"&gt;catch&lt;/span&gt;(Exception e)&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;&lt;span class="rem"&gt;// Client&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;import GetDateModule.*;&lt;br /&gt;import org.omg.CosNaming.*;&lt;br /&gt;import org.omg.CosNaming.NamingContextPackage.*;&lt;br /&gt;import org.omg.CORBA.*;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.lang.String;&lt;br /&gt;import java.util.Date;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; GetDateClient&lt;br /&gt;{&lt;br /&gt;  &lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; main(String args[])&lt;br /&gt;   {&lt;br /&gt;       GetDate GetDateImpl=&lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;       &lt;span class="kwrd"&gt;int&lt;/span&gt; i;   &lt;br /&gt;       &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;br /&gt;       {&lt;br /&gt;           &lt;span class="rem"&gt;// initialize the ORB&lt;/span&gt;&lt;br /&gt;           org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,&lt;span class="kwrd"&gt;null&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;           org.omg.CORBA.Object objRef = orb.resolve_initial_references(&lt;span class="str"&gt;"NameService"&lt;/span&gt;);&lt;br /&gt;           NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);&lt;br /&gt;          &lt;br /&gt;           String name = &lt;span class="str"&gt;"GetDate"&lt;/span&gt;;&lt;br /&gt;           GetDateImpl = GetDateHelper.narrow(ncRef.resolve_str(name));&lt;br /&gt;&lt;br /&gt;           Date dt=&lt;span class="kwrd"&gt;new&lt;/span&gt; Date();&lt;br /&gt;           &lt;span class="kwrd"&gt;long&lt;/span&gt; clientTime=dt.getTime();&lt;br /&gt;           System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"Client Date and Time="&lt;/span&gt;+dt);&lt;br /&gt;&lt;br /&gt;           String serverDate=(String) GetDateImpl.get_date();&lt;br /&gt;          &lt;br /&gt;           &lt;span class="kwrd"&gt;long&lt;/span&gt; serverTime=(&lt;span class="kwrd"&gt;long&lt;/span&gt;) GetDateImpl.get_time();&lt;br /&gt;           System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"Server Date and Time="&lt;/span&gt;+serverDate);&lt;br /&gt;  &lt;br /&gt;           System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(&lt;span class="str"&gt;"Time Difference in Server and Client(in millisecond)="&lt;/span&gt;+(clientTime-serverTime));&lt;br /&gt;          &lt;br /&gt;       }&lt;br /&gt;       &lt;span class="kwrd"&gt;catch&lt;/span&gt;(Exception e)&lt;br /&gt;       {&lt;br /&gt;           e.printStackTrace();&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-8528379665901350579?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8528379665901350579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/04/corba-program-of-date-operations-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8528379665901350579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8528379665901350579'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/04/corba-program-of-date-operations-in.html' title='Corba program of date operations in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1724258397492369313</id><published>2011-01-30T06:30:00.000-08:00</published><updated>2011-01-30T06:34:48.436-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><title type='text'>Character Escape Sequence in Java</title><content type='html'>&lt;span style="font-family:courier new;"&gt;java comes with a solution to that, here the Character Escape Sequence of Java comes to rescue. The escape sequence allows you to embed special characters like double quotes, line feed, carriage return, tab, etc. into the same String. The above example is corrected as follows:-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;String str = "Hello, I am Learning \"Java\"";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Now this is the correct way as per Java. What Java sees is that anything after the "\" symbol is to be placed as it is, and is a part of the whole String overall. Though the symbol "\" has different implications with regard to other escape sequences, like "\n" inserts a new line, etc.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;The Character escape Sequence in Java is shown below:-&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Escape Sequence ------------Purpose&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\ddd ------------ Octal character (ddd)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\uxxxx ------------ Hexadecimal UNICODE character (xxxx)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\’ ------------ Single quote&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\” ------------ Double quote&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\\ ------------ Backslash&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\r ------------ Carriage return&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\n ------------ New line (also known as line feed)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\f ------------ Form feed&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\t ------------ Tab&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;\b ------------ Backspace&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-1724258397492369313?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1724258397492369313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/character-escape-sequence-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1724258397492369313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1724258397492369313'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/character-escape-sequence-in-java.html' title='Character Escape Sequence in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3629227856210880359</id><published>2011-01-30T06:25:00.000-08:00</published><updated>2011-01-30T06:29:42.709-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to find Prime Number in Java</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: courier new;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;public class primeNumber&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;public static void main(String[] args)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;InputStreamReader ir = new InputStreamReader(System.in);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;BufferedReader br = new BufferedReader(ir);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;System.out.println("Enter the number you want to test for prime number:");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;int num =0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;int check = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;try {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;num = Integer.parseInt(br.readLine());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;for (int i=2; i &lt; num/2; i++ )&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;if(num%i == 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;check = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;check = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;if(check == 1 || num == 2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;System.out.println("The number is prime");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;System.out.println("The number is not prime");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;} catch (NumberFormatException e)&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;System.out.println("Kindly enter a proper integer number");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;} catch (IOException e)&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;System.out.println("There is some error in the input output handling");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;} &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-3629227856210880359?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3629227856210880359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-find-prime-number-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3629227856210880359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3629227856210880359'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-find-prime-number-in-java.html' title='Program to find Prime Number in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8906376562937808414</id><published>2011-01-30T06:22:00.000-08:00</published><updated>2011-01-30T06:25:37.762-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program in Java code for finding Prime Number</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class primeNumber &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public static void main(String[] args)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    InputStreamReader ir = new InputStreamReader(System.in);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    BufferedReader br = new BufferedReader(ir);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    System.out.println("Enter the number you want to test for prime number:");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    int num =0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    int check = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; try &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  num = Integer.parseInt(br.readLine());  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;     for (int i=2; i &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      if(num%i == 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      {       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       check = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      } &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       check = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;     }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;     if(check == 1 || num == 2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;     {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      System.out.println("The number is prime");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;     }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;     else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;     {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      System.out.println("The number is not prime");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;     }     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; } catch (NumberFormatException e) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.out.println("Kindly enter a proper integer number");&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; } &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch (IOException e) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.out.println("There is some error in the input output handling");  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; }    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-8906376562937808414?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8906376562937808414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-in-java-code-for-finding-prime.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8906376562937808414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8906376562937808414'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-in-java-code-for-finding-prime.html' title='Program in Java code for finding Prime Number'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-4228431392366628953</id><published>2011-01-30T06:19:00.002-08:00</published><updated>2011-01-30T06:21:55.003-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java program to find the Factorial of a given number</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.BufferedReader;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.IOException;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.InputStreamReader;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class Factorial&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String[] args) throws NumberFormatException, IOException &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;long num;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("Enter a number greater then or equal to 0 and less then 40 for which the factorial is desired:-");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;InputStreamReader ir = new InputStreamReader(System.in);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;BufferedReader br = new BufferedReader(ir);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;num = Integer.parseInt(br.readLine());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(num&gt;=0 &amp;amp;&amp;amp; num &lt; 40)&lt;br /&gt;{&lt;br /&gt;if(num == 0)&lt;br /&gt;{&lt;br /&gt;num =1;&lt;br /&gt;}&lt;br /&gt;System.out.println(factorial(num));&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;System.out.println("Number out of range");&lt;br /&gt;}&lt;br /&gt;} &lt;br /&gt;private static long factorial(long num) &lt;br /&gt;{&lt;br /&gt;if(num &gt; 1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;num = num * factorial(num-1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;return num;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;return num;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-4228431392366628953?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/4228431392366628953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/java-program-to-find-factorial-of-given.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4228431392366628953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4228431392366628953'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/java-program-to-find-factorial-of-given.html' title='Java program to find the Factorial of a given number'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-6718956534242491931</id><published>2011-01-30T06:19:00.001-08:00</published><updated>2011-01-30T06:19:49.514-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to find the Area and Circumference of Circle in Java</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new; font-weight: bold;"&gt;import java.io.BufferedReader;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.io.InputStreamReader;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class AreaCircumferenceCircle&lt;br /&gt;{&lt;br /&gt;final static float pi = 22/7f;&lt;br /&gt;&lt;br /&gt;public static void main(String[] args) throws NumberFormatException, IOException&lt;br /&gt;{&lt;br /&gt;System.out.println("Enter the radius of the circle: ");&lt;br /&gt;InputStreamReader io= new InputStreamReader(System.in);&lt;br /&gt;BufferedReader br = new BufferedReader(io);&lt;br /&gt;float radius = Float.parseFloat(br.readLine());&lt;br /&gt;System.out.println("Area of the Circle is: "+radius*radius*pi);&lt;br /&gt;System.out.println("Circumference of the Circle is: "+2*radius*pi);&lt;br /&gt;}&lt;br /&gt;}&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-6718956534242491931?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/6718956534242491931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-find-area-and-circumference.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6718956534242491931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6718956534242491931'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-find-area-and-circumference.html' title='Program to find the Area and Circumference of Circle in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-7141032491721826619</id><published>2011-01-30T05:42:00.000-08:00</published><updated>2011-01-30T06:06:22.760-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to calculate Area and Perimeter of Rectangle in Java</title><content type='html'>import java.io.IOException;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class AreaPerimeterRectangle &lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;public static void main(String[] args) throws NumberFormatException, IOException &lt;br /&gt;{&lt;br /&gt;System.out.println("Enter the length and width of the rectangle: ");&lt;br /&gt;float length = Float.parseFloat(args[0]);&lt;br /&gt;float width = Float.parseFloat(args[1]);&lt;br /&gt;System.out.println("Area of the Rectangle is: "+length*width);&lt;br /&gt;System.out.println("Perimeter of the Rectangle is: "+2*(length+width));&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/6660638602196740640-7141032491721826619?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/7141032491721826619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-calculate-area-and-perimeter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/7141032491721826619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/7141032491721826619'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-calculate-area-and-perimeter.html' title='Program to calculate Area and Perimeter of Rectangle in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-2595407549584847240</id><published>2011-01-30T05:08:00.000-08:00</published><updated>2011-01-30T05:10:49.842-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Sorting array in Ascending order in Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.util.TreeSet;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class SortingAscending &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;@SuppressWarnings("unchecked")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String[] args) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int[] num = {3,5,9,2,1,0,45,23,67,93};&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TreeSet ts = new TreeSet();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;for(int i = 0; i &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ts.add(num[i]);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("The numbers of the array set in ascending order are: "+ts);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-2595407549584847240?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/2595407549584847240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/sorting-array-in-ascending-order-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2595407549584847240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2595407549584847240'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/sorting-array-in-ascending-order-in.html' title='Sorting array in Ascending order in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-4178991841839125106</id><published>2011-01-30T04:33:00.000-08:00</published><updated>2011-01-30T05:08:45.694-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to find Length of a given String in java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.BufferedReader;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.IOException;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.InputStreamReader;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class NoOfWordsInString &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String[] args) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;throws IOException &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("Enter a string or number for which the number of words is to be counted: ");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;InputStreamReader isr = new InputStreamReader(System.in);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;BufferedReader br = new BufferedReader(isr);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String str = br.readLine();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("The no of words in the string are: "+str.length());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-4178991841839125106?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/4178991841839125106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-find-length-of-given-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4178991841839125106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4178991841839125106'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-find-length-of-given-string.html' title='Program to find Length of a given String in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1778998878514084714</id><published>2011-01-30T04:30:00.000-08:00</published><updated>2011-01-30T04:32:50.660-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to Reverse a String in Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.BufferedReader;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.IOException;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.InputStreamReader;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class ReverseString&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;/**&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;* @param args&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;* @throws IOException&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String[] args) throws IOException&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("Enter a string to be reversed: ");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;InputStreamReader isr = new InputStreamReader(System.in);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;BufferedReader br = new BufferedReader(isr);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String str = br.readLine();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;StringBuffer sb = new StringBuffer().append(str);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("The reversed string is:\n"+sb.reverse().toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-1778998878514084714?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1778998878514084714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-reverse-string-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1778998878514084714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1778998878514084714'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/program-to-reverse-string-in-java.html' title='Program to Reverse a String in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-5422537586026647901</id><published>2011-01-19T09:52:00.000-08:00</published><updated>2011-01-19T09:57:49.011-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aniket gadekar'/><title type='text'>Aniket Gadekar</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_7yyVsGPueko/TTclcrCQIQI/AAAAAAAAAt4/7-Q--D9-9yM/s1600/aniket%2Bgadekar.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 250px; height: 400px;" src="http://4.bp.blogspot.com/_7yyVsGPueko/TTclcrCQIQI/AAAAAAAAAt4/7-Q--D9-9yM/s400/aniket%2Bgadekar.jpg" alt="" id="BLOGGER_PHOTO_ID_5563957039158272258" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div  style="text-align: center; font-weight: bold;font-family:verdana;"&gt;&lt;span style="font-size:100%;"&gt;aniket gadekar, nagpur&lt;br /&gt;Ph : 08878644295, 09970351838&lt;br /&gt;email : aniketgadekar4967@gmail.com&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-5422537586026647901?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/5422537586026647901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2011/01/aniket-gadekar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5422537586026647901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5422537586026647901'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2011/01/aniket-gadekar.html' title='Aniket Gadekar'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7yyVsGPueko/TTclcrCQIQI/AAAAAAAAAt4/7-Q--D9-9yM/s72-c/aniket%2Bgadekar.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6660638602196740640.post-2768839331823875265</id><published>2010-11-19T07:03:00.000-08:00</published><updated>2010-11-19T07:04:28.178-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='classes in java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to show Continue and break statements in Java</title><content type='html'>class ContinueBreak&lt;br /&gt;{&lt;br /&gt; public static void main(String args[])&lt;br /&gt; {&lt;br /&gt;  int i,j;&lt;br /&gt;  LOOP1:for(i=1;i&lt;=100;i++)&lt;br /&gt;  {&lt;br /&gt;   System.out.println(" ");&lt;br /&gt;   if(i&gt;=10) break;&lt;br /&gt;   for(j=1;j&lt;=100;j++);&lt;br /&gt;   {&lt;br /&gt;    System.out.print(" * ");&lt;br /&gt;    if(j==i)&lt;br /&gt;    continue LOOP1;&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  System.out.println("Termination by BREAK");&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/6660638602196740640-2768839331823875265?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/2768839331823875265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/11/program-to-show-continue-and-break.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2768839331823875265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2768839331823875265'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/11/program-to-show-continue-and-break.html' title='Program to show Continue and break statements in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-900004255825278787</id><published>2010-11-19T07:02:00.000-08:00</published><updated>2010-11-19T07:03:03.878-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='classes in java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to show Common line interface in Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;class ComLineArgs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int count,i=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String str;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;count=args.length;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("number of arguments="+count);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;while(i&lt;/span&gt;&lt;=count)&lt;br /&gt;{&lt;br /&gt;str=args[i];&lt;br /&gt;i++;&lt;br /&gt;System.out.print(i+: "+"java is"+str);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/count)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-900004255825278787?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/900004255825278787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/11/program-to-show-common-line-interface.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/900004255825278787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/900004255825278787'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/11/program-to-show-common-line-interface.html' title='Program to show Common line interface in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1454486721953791024</id><published>2010-10-01T10:30:00.001-07:00</published><updated>2010-10-01T10:30:46.004-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='classes in java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to show class Casting in Java</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new; font-weight: bold;"&gt;class Casting&lt;br /&gt;{&lt;br /&gt;public static void main(String args[])&lt;br /&gt;{&lt;br /&gt;float sum;&lt;br /&gt;int i;&lt;br /&gt;sum=0.0f;&lt;br /&gt;for(i=1;i&lt;=10;i++)&lt;br /&gt;{&lt;br /&gt;sum=sum+1/(float)i;&lt;br /&gt;System.out.print("i="+i);&lt;br /&gt;System.out.println("sum:"+sum);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-1454486721953791024?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1454486721953791024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/10/program-to-show-class-casting-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1454486721953791024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1454486721953791024'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/10/program-to-show-class-casting-in-java.html' title='Program to show class Casting in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-4332819973539370945</id><published>2010-10-01T10:27:00.000-07:00</published><updated>2010-10-01T10:29:25.921-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='classes in java'/><title type='text'>Creating Application Server in Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;//import classes&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.net.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.util.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import javax.swing.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import javax.swing.Timer;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.net.InetAddress;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.net.UnknownHostException;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//Code for the AppServer class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class MyFrame extends Frame implements ActionListener&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    MyFrame()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        setSize(600,400);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        setVisible(true);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    this.setTitle("Welcome to server");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        JPanel panel=new JPanel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        //panel.setBackground(new Color(0,100,100));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        setLayout(new FlowLayout());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        JButton btnReport;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        JButton btnExit;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        btnReport=new JButton("Report");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        panel.add(btnReport);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        btnExit=new JButton("Exit");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        panel.add(btnExit);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        add(panel);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        btnReport.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        btnExit.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        setVisible(true);//add listener to the Login button&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String str = ae.getActionCommand();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        if(str.equals("Report"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            new Reportjen();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        else if(str.equals("Exit"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            System.exit(0);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class AppServer implements Runnable&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    ServerSocket server;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Socket fromClient;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Thread serverThread;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    InetAddress host;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public AppServer()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        MyFrame obj=new MyFrame();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        System.out.println("Conference Engine started...");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            host = InetAddress.getLocalHost();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            System.out.println("Host name:'" + host.getHostName()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;              + "' has IP address: " + host.getHostAddress());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            server = new ServerSocket(1001);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            serverThread = new Thread(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            serverThread.start();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        catch (UnknownHostException e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;              e.printStackTrace();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        catch(Exception e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            System.out.println("Cannot start the thread: " + e);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        new AppServer();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public void run()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            while(true)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                //Listening to the clients request&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                fromClient = server.accept();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                //Creating the connect object&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                Connect con = new Connect(fromClient);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        catch(Exception e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;              System.out.println("Cannot listen to the client" + e);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//Code for the connect class&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Connect&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;          ObjectOutputStream streamToClient;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    int ctr=0;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    BufferedReader streamFromClient;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        static Vector vector;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    static Vector vctrList;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    String message=" ";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    static String str=new String("UsrList");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        static&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;           vector=new Vector(1,1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       vctrList=new Vector(1,1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;       vctrList.addElement((String)str);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    int verify(String mesg)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        RandomAccessFile RAS=new RandomAccessFile("UsrPwd.txt", "r");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        int i=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String str="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        while((RAS.getFilePointer())!=(RAS.length()))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            str=RAS.readLine();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            if(str.equals(mesg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                ctr=1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                break;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        RAS.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        catch(Exception e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        return ctr;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }//end of verify()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int checkFile(String mesg)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        int chk=1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        RandomAccessFile RS=new RandomAccessFile("UsrPwd.txt", "r");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        int i=0;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String str="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String colon=new String(":");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        int index=((String)mesg).lastIndexOf(colon);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String userName=(String)mesg.substring(0,index);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        while((RS.getFilePointer())!=(int)(RS.length()))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            str=RS.readLine();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            int index1=((String)str).lastIndexOf(colon);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            String usrName=(String)str.substring(0,index1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            if(usrName.equals(userName))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                chk=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                break;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }//end of while&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        RS.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }//end of try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        catch(Exception e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        return chk;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}//end of chkFile&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public Connect(Socket inFromClient)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        //Retrieving the clients stream&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String msg="",msg1="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        String mesg="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            streamFromClient = new     BufferedReader(new InputStreamReader(inFromClient.getInputStream()));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        streamToClient= new ObjectOutputStream(inFromClient.getOutputStream());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            msg=streamFromClient.readLine();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            //mesg=streamFromClient.readLine();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            if((msg.equals("From Timer")))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                streamToClient.writeObject(vector);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                       streamToClient.writeObject(vctrList);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            else if(msg.equals("LoginInfo"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;             {    System.out.println(inFromClient.getInetAddress());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                 msg=streamFromClient.readLine();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                int ver=verify(msg);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                if(ver==1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                   {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    msg1=streamFromClient.readLine();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                     FileOutputStream out = new FileOutputStream("Loginfo.txt",true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                                 PrintStream p = new PrintStream( out );&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                                 p.println();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                                p.println(msg1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                                p.close();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String colon=new String(":");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    int index=((String)msg).lastIndexOf(colon);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    String userName=(String)msg.substring(0,index) +inFromClient.getInetAddress();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    if(!(vctrList.indexOf((String)userName)&gt;0))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        streamToClient.writeObject("Welcome"+inFromClient.getInetAddress());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        vctrList.addElement((String)userName);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    streamToClient.writeObject("Login denied");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                 }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            else if(msg.equals("RegisterInfo"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                msg=streamFromClient.readLine();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                int ret=checkFile(msg);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                if(ret==0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                streamToClient.writeObject("User Exists");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                if(ret==1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    FileOutputStream out = new FileOutputStream("UsrPwd.txt",true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    PrintStream p = new PrintStream( out );&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    p.println();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                p.println(msg);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    p.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    streamToClient.writeObject("Registered");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            else if(msg.equals("User Logout"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String remUser=streamFromClient.readLine();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                boolean b=vctrList.removeElement((String)remUser);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            else&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                message=message+msg;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                vector.addElement((String)message);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                   streamToClient.writeObject(vector);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }//end of try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            catch(Exception e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            System.out.println("Cannot get the client stream connect" + e);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                finally&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                    try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                      {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                          inFromClient.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                      }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                          catch(IOException e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                      {}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }//end of connect&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-4332819973539370945?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/4332819973539370945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/10/creating-application-server-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4332819973539370945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4332819973539370945'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/10/creating-application-server-in-java.html' title='Creating Application Server in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-7305624724993566558</id><published>2010-10-01T10:26:00.000-07:00</published><updated>2010-10-01T10:27:26.557-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to find area of Rectangle in java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;abstract class Figure&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double dim1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double dim2;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Figure(double a, double b)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dim1=a;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dim2=b;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;abstract double area();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Rectangle extends Figure&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Rectangle(double a, double b)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;super(a,b);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double area()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("Area of Rectangle");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;return(dim1*dim2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Triangle extends Figure&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Triangle(double a, double b)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;super(a,b);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double area()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("area of triangle");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;return(dim1*dim2/2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class AbstractArea&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Rectangle r=new Rectangle(10,5);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Triangle t=new Triangle(10,2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Figure figref;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;figref=r;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double d1=figref.area();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println(d1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;figref=t;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double d2=figref.area();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println(d2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-7305624724993566558?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/7305624724993566558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/10/program-to-find-area-of-rectangle-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/7305624724993566558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/7305624724993566558'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/10/program-to-find-area-of-rectangle-in.html' title='Program to find area of Rectangle in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-2215605957891140646</id><published>2010-07-25T08:59:00.000-07:00</published><updated>2010-07-25T09:00:31.900-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Creating circle in java</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new; font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;interface NewShape&lt;br /&gt;{&lt;br /&gt;//void draw();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;interface Circle extends NewShape&lt;br /&gt;{&lt;br /&gt;void getRadius();&lt;br /&gt;int radius=10;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class NewCircle implements Circle&lt;br /&gt;{&lt;br /&gt;public void getRadius()&lt;br /&gt;{&lt;br /&gt;System.out.println(radius);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;class ExtendInterface extends NewCircle&lt;br /&gt;{&lt;br /&gt;public static void main(String args[])&lt;br /&gt;{&lt;br /&gt;Circle nc=new NewCircle();&lt;br /&gt;nc.getRadius();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-2215605957891140646?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/2215605957891140646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/creating-circle-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2215605957891140646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2215605957891140646'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/creating-circle-in-java.html' title='Creating circle in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1559284206944747291</id><published>2010-07-25T08:55:00.000-07:00</published><updated>2010-07-25T08:58:43.308-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Error handling in java catch throw.</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;class Error1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;int a=10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;int b=5;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;int c=5;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;int x,y;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;x=a/(b-c);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;catch(ArithmeticException e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;System.out.println("Division by zero");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;y=a/(b+c);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;System.out.println("Result="+y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;}&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-1559284206944747291?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1559284206944747291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/error-handling-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1559284206944747291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1559284206944747291'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/error-handling-in-java.html' title='Error handling in java catch throw.'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-6709110652543977633</id><published>2010-07-25T08:51:00.000-07:00</published><updated>2010-07-25T08:55:42.023-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='classes in java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Bank project of simple intrest in java.</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;interface account &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;float rate=8.5f;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void set(int accno);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void display();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;interface person&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void store(String name, String address);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Customer implements account, person&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int accno, numyears;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;float bal;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String name="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String address="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Customer(float a, int b)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;bal=a;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;numyears=b;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void set(int accno)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;this.accno=accno;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void display()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("the account no. and balance is: "+accno+bal);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void store(String name, String address)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;this.name=name;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;this.address=address;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void show()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("the name and the address is:"+name+" "+address);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void interest()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;float si=bal*numyears*rate/100;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("the simple interest is:"+si);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Details&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Customer c1=new Customer(15.0f, 2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;c1.set(100);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;c1.store("Popsys","nagpur");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;c1.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;c1.display();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;c1.interest();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-6709110652543977633?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/6709110652543977633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/bank-project-of-simple-intrest-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6709110652543977633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6709110652543977633'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/bank-project-of-simple-intrest-in-java.html' title='Bank project of simple intrest in java.'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1924525198619934979</id><published>2010-07-25T08:45:00.000-07:00</published><updated>2010-07-25T08:48:26.881-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Projects'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>File operation in java</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class CopyFile&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  FileInputStream A=null;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  FileOutputStream B=null;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int b;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  try&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  A=new FileInputStream("a.txt");&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  B = new FileOutputStream("b.txt");&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  while((b=A.read())!=-1)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;   B.write(b);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  A.close();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  B.close();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.out.println("File copied successfully");&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; catch(IOException e)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; System.out.println("file not found");&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-1924525198619934979?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1924525198619934979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/file-operation-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1924525198619934979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1924525198619934979'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/file-operation-in-java.html' title='File operation in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3371841544099567977</id><published>2010-07-25T08:43:00.000-07:00</published><updated>2010-07-25T08:45:49.373-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='classes in java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Creating pyramid of asterisk in java</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class ContinueBreak&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int i,j;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  LOOP1:for(i=1;i&lt;=100;i++)   &lt;br /&gt;{    &lt;br /&gt;System.out.println(" ");    &lt;br /&gt;if(i&gt;=10)&lt;br /&gt;break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;   for(j=1;j&lt;=100;j++);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;   {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    System.out.print(" * ");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    if(j==i)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    continue LOOP1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.out.println("Termination by BREAK");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-3371841544099567977?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3371841544099567977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/creating-pyramid-of-asterisk-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3371841544099567977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3371841544099567977'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/creating-pyramid-of-asterisk-in-java.html' title='Creating pyramid of asterisk in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3488639188192552166</id><published>2010-07-25T08:41:00.000-07:00</published><updated>2010-07-25T08:42:56.544-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>While loop in Java</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class ComLineArgs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int count,i=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String str;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;count=args.length;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("number of arguments="+count);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;while(i&lt;=count)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;str=args[i];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;i++;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.print(i+: "+"java is"+str);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-3488639188192552166?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3488639188192552166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/while-loop-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3488639188192552166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3488639188192552166'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/while-loop-in-java.html' title='While loop in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-4160247524791299145</id><published>2010-07-25T08:38:00.000-07:00</published><updated>2010-07-25T08:40:58.107-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Creating | drawing circle in Java</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;interface NewShape&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void draw();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class NewCircle1 implements NewShape&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void draw()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("new circle 1 is drawn");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class NewCircle2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void draw()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("new cirlce 2 is drawn");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class CastInterface&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;NewShape nc1=new NewCircle1();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;NewCircle2 nc2=new NewCircle2();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;nc1.draw();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;nc2.draw();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-4160247524791299145?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/4160247524791299145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/creating-drawing-circle-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4160247524791299145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4160247524791299145'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/creating-drawing-circle-in-java.html' title='Creating | drawing circle in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3711273516457093597</id><published>2010-07-25T08:36:00.000-07:00</published><updated>2010-07-25T08:38:51.847-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='classes in java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Creating class in Java.</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class A&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void show()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("method of class A");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class B extends A&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void show()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("method of class b");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class C extends A&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    void show()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        System.out.println("method of class c");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class MethodDispath&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        class A a=new A();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        class B b=new B();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        class A c=new C();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        A aa;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        aa=a;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        aa.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        aa.b;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        aa.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        aa=c;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        aa.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-3711273516457093597?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3711273516457093597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/creating-class-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3711273516457093597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3711273516457093597'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/creating-class-in-java.html' title='Creating class in Java.'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8233272689922789440</id><published>2010-07-25T08:34:00.000-07:00</published><updated>2010-07-25T08:36:55.623-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Abstract Demo Program in Java</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;abstract class classA&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;abstract void show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void display()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("this is a concrete method");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class classB extends classA&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void show()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("classb implementation of show method");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class AbstractDemo&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;classB b1=new classB();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;b1.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;b1.display();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-8233272689922789440?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8233272689922789440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/abstract-demo-program-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8233272689922789440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8233272689922789440'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/abstract-demo-program-in-java.html' title='Abstract Demo Program in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-7491389321828841606</id><published>2010-07-25T08:32:00.000-07:00</published><updated>2010-07-25T08:34:24.899-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to calculate Area of Rectangle in java</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;abstract class Figure&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double dim1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double dim2;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Figure(double a, double b)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dim1=a;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dim2=b;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;abstract double area();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Rectangle extends Figure&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Rectangle(double a, double b)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;super(a,b);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double area()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("Area of Rectangle");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;return(dim1*dim2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Triangle extends Figure&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Triangle(double a, double b)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;super(a,b);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double area()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("area of triangle");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;return(dim1*dim2/2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class AbstractArea&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Rectangle r=new Rectangle(10,5);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Triangle t=new Triangle(10,2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Figure figref;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;figref=r;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double d1=figref.area();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println(d1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;figref=t;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;double d2=figref.area();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println(d2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-7491389321828841606?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/7491389321828841606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/program-to-calculate-area-of-rectangle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/7491389321828841606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/7491389321828841606'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/program-to-calculate-area-of-rectangle.html' title='Program to calculate Area of Rectangle in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3311483209879645919</id><published>2010-07-25T05:45:00.002-07:00</published><updated>2010-07-25T05:46:45.900-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java applet program for interest rate calculation</title><content type='html'>&lt;pre name="code" class="Cpp"&gt;&lt;br /&gt;import java.awt.*;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;import java.applet.*;&lt;br /&gt;/*&lt;br /&gt;&lt;applet code="Loan" width=300 height=300&gt;&lt;br /&gt;&lt;/applet&gt;&lt;br /&gt;*/&lt;br /&gt;public class Loan extends Applet&lt;br /&gt;implements ActionListener,ItemListener&lt;br /&gt;{&lt;br /&gt; double p,r,n,total,i;&lt;br /&gt; String param1;&lt;br /&gt; boolean month;&lt;br /&gt; Label l1,l2,l3,l4;&lt;br /&gt; TextField t1,t2,t3,t4;&lt;br /&gt; Button b1,b2;&lt;br /&gt; CheckboxGroup cbg;&lt;br /&gt; Checkbox c1,c2;&lt;br /&gt; String str;&lt;br /&gt; public void init()&lt;br /&gt; {&lt;br /&gt;  l1=new Label("Balance Amount",Label.LEFT);&lt;br /&gt;  l2=new Label("Number of Months",Label.LEFT);&lt;br /&gt;  l3=new Label("Interest Rate",Label.LEFT);&lt;br /&gt;  l4=new Label("Total Payment",Label.LEFT);&lt;br /&gt;  t1=new TextField(5);&lt;br /&gt;  t2=new TextField(5);&lt;br /&gt;  t3=new TextField(15);&lt;br /&gt;  t4=new TextField(20);&lt;br /&gt;  b1=new Button("OK");&lt;br /&gt;  b2=new Button("Delete");&lt;br /&gt;  cbg=new CheckboxGroup();&lt;br /&gt;  c1=new Checkbox("Month Rate",cbg,true);&lt;br /&gt;  c2=new Checkbox("Annual Rate",cbg,true);&lt;br /&gt;  t1.addActionListener(this);&lt;br /&gt;  t2.addActionListener(this);&lt;br /&gt;  t3.addActionListener(this);&lt;br /&gt;  t4.addActionListener(this);&lt;br /&gt;  b1.addActionListener(this);&lt;br /&gt;  b2.addActionListener(this);&lt;br /&gt;  c1.addItemListener(this);&lt;br /&gt;  c2.addItemListener(this);&lt;br /&gt;  add(l1);&lt;br /&gt;  add(t1);&lt;br /&gt;  add(l2);&lt;br /&gt;  add(t2);&lt;br /&gt;  add(l3);&lt;br /&gt;  add(t3);&lt;br /&gt;  add(l4);&lt;br /&gt;  add(t4);&lt;br /&gt;  add(c1);&lt;br /&gt;  add(c2);&lt;br /&gt;  add(b1);&lt;br /&gt;  add(b2);&lt;br /&gt; }&lt;br /&gt; public void itemStateChanged(ItemEvent ie)&lt;br /&gt; {&lt;br /&gt; }&lt;br /&gt; public void actionPerformed(ActionEvent ae)&lt;br /&gt; {&lt;br /&gt;  str=ae.getActionCommand();&lt;br /&gt;  if(str.equals("OK"))&lt;br /&gt;  {&lt;br /&gt;   p=Double.parseDouble(t1.getText());&lt;br /&gt;   n=Double.parseDouble(t2.getText());&lt;br /&gt;   r=Double.parseDouble(t3.getText());&lt;br /&gt;   if(c2.getState())&lt;br /&gt;   {&lt;br /&gt;    n=n/12;&lt;br /&gt;   }&lt;br /&gt;   i=(p*n*r)/100;&lt;br /&gt;   total=p+i;&lt;br /&gt;   t4.setText(" "+total);&lt;br /&gt;  }&lt;br /&gt;  else if(str.equals("Delete"))&lt;br /&gt;  {&lt;br /&gt;   t1.setText(" ");&lt;br /&gt;   t2.setText(" ");&lt;br /&gt;   t3.setText(" ");&lt;br /&gt;   t4.setText(" ");&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/6660638602196740640-3311483209879645919?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3311483209879645919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-applet-program-for-interest-rate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3311483209879645919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3311483209879645919'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-applet-program-for-interest-rate.html' title='Java applet program for interest rate calculation'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-6261889029370304226</id><published>2010-07-25T05:45:00.001-07:00</published><updated>2010-07-25T05:45:24.826-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java applet program that allows the user to draw lines, rectangles and ovals</title><content type='html'>Color c1=new Color(35-i,55-i,110-i);&lt;br /&gt;g.setColor(c1);&lt;br /&gt;g.drawRect(250+i,250+i,100+i,100+i);&lt;br /&gt;g.drawOval(100+i,100+i,50+i,50+i);&lt;br /&gt;g.drawLine(50+i,20+i,10+i,10+i);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-6261889029370304226?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/6261889029370304226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-applet-program-that-allows-user-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6261889029370304226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6261889029370304226'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-applet-program-that-allows-user-to.html' title='Java applet program that allows the user to draw lines, rectangles and ovals'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3367555986680219414</id><published>2010-07-25T05:44:00.001-07:00</published><updated>2010-07-25T05:44:50.841-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java program to implement a shape selector from a given set of shapes by Ranjith | April 4th, 2010.  To implement a shape selector from a given set o</title><content type='html'>import java.awt*;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;import java.applet.*;&lt;br /&gt; &lt;br /&gt;public class fillcolor extends Applet implement Item Listener&lt;br /&gt;{&lt;br /&gt; checkbox red,yellow,black,blue.orange;&lt;br /&gt; CheckboxGroup cbg;&lt;br /&gt; String msg;&lt;br /&gt; String s1="red";&lt;br /&gt; String s2="yellow";&lt;br /&gt; String s3="black";&lt;br /&gt; String s4="orange";&lt;br /&gt; public void init()&lt;br /&gt; {&lt;br /&gt;  cbg = new CheckboxGroup();&lt;br /&gt;  red = new Chechbox("red",cbg,true);&lt;br /&gt;  yellow= new Checkbox("yellow",cbg,false);&lt;br /&gt;  black = new checkbox("black",cbg,false);&lt;br /&gt;  blue = new Checkbox("blue",cbg,false);&lt;br /&gt;  orange = new checkbox("orange".cbg.false);&lt;br /&gt;  add(red);&lt;br /&gt;  add(yellow);&lt;br /&gt;  add(black);&lt;br /&gt;  add(blue);&lt;br /&gt;  add(orange);&lt;br /&gt;  red.addItemListener(this);&lt;br /&gt;  yellow.addItemListener(this);&lt;br /&gt;  black.addItemListener(this);&lt;br /&gt;  blue.addItemListener(this);&lt;br /&gt;  orange.addItemListener(this);&lt;br /&gt; }&lt;br /&gt; publice void itemStartechanged(ItemEvent ie)&lt;br /&gt; {&lt;br /&gt;  repaint();&lt;br /&gt; }&lt;br /&gt; publice void paint (Graphics g)&lt;br /&gt; {&lt;br /&gt;  msg = cbg.getSelectedCheckbox().getLabel();&lt;br /&gt;  if(msg.compareTo(s1)==0)&lt;br /&gt;  { &lt;br /&gt;      setBackground(Color.red);&lt;br /&gt;  }&lt;br /&gt;  else if (msg.compareTo(s2)==0)&lt;br /&gt;  {&lt;br /&gt;      setBackground(Color.yellow);&lt;br /&gt;  }&lt;br /&gt;  else if(msg.compare To(s3)==0)&lt;br /&gt;  {&lt;br /&gt;      setBackground(color.black);&lt;br /&gt;  }&lt;br /&gt;  else if (msg.compareTo(s4)==o)&lt;br /&gt;  {&lt;br /&gt;      setBackground(Color.blue);&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;      set Background(Color.orange);&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/6660638602196740640-3367555986680219414?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3367555986680219414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-implement-shape_25.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3367555986680219414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3367555986680219414'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-implement-shape_25.html' title='Java program to implement a shape selector from a given set of shapes by Ranjith | April 4th, 2010.  To implement a shape selector from a given set o'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-5956833482915224393</id><published>2010-07-25T05:43:00.000-07:00</published><updated>2010-07-25T05:44:12.251-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java program to implement a shape selector from a given set of shapes</title><content type='html'>import java.awt.*;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;import java.applet.*;&lt;br /&gt; &lt;br /&gt;public class shape extend Applet implements itemListener&lt;br /&gt;{&lt;br /&gt;Chekbox reet,circle,line;&lt;br /&gt;ChekboxGroup cbg;&lt;br /&gt; &lt;br /&gt;String msg;&lt;br /&gt;String s1="reet";&lt;br /&gt;String s2="circle";&lt;br /&gt;string s3="line";&lt;br /&gt;publice void init()&lt;br /&gt;{&lt;br /&gt;cbg=new checkboxGroup();&lt;br /&gt; &lt;br /&gt;rect = new checkbox("reet,cbg,tru);&lt;br /&gt;circle = new Checkbox("circle",cbg.false);&lt;br /&gt;line = new Checkbox("line",cbg,false);&lt;br /&gt; &lt;br /&gt;add(reet);&lt;br /&gt;add(circle);&lt;br /&gt;add(line);&lt;br /&gt; &lt;br /&gt;rect.addItemListener(this);&lt;br /&gt;circle.addItemLisener(this);&lt;br /&gt;line.addItemListener(this);&lt;br /&gt;}&lt;br /&gt;public void item StateChanged(ItemEvent ie)&lt;br /&gt;{&lt;br /&gt;repaint();&lt;br /&gt;}&lt;br /&gt;publice void paint(Graphics g)&lt;br /&gt;{&lt;br /&gt;msg=cbg.getSlectedCheckbox().getLabel();&lt;br /&gt;if(masg.compareTo(s1)==0)&lt;br /&gt;{&lt;br /&gt;g.drawRect(10,40,40,80);&lt;br /&gt;}&lt;br /&gt;else if(msg.compareTo(s2)==0)&lt;br /&gt;{&lt;br /&gt;g.drawOvel(10,40,80,80);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;g.drawLine(0,0,100,100);&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/6660638602196740640-5956833482915224393?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/5956833482915224393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-implement-shape.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5956833482915224393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5956833482915224393'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-implement-shape.html' title='Java program to implement a shape selector from a given set of shapes'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-5520052334603482207</id><published>2010-07-25T05:42:00.002-07:00</published><updated>2010-07-25T05:43:04.725-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java program that illustrates how run time polymorphism is achieved</title><content type='html'>figure f=new figure(45,6);&lt;br /&gt;rectangle r=new rectangle(10,30);&lt;br /&gt;triangle t=new triangle(10,20);&lt;br /&gt;figure a;&lt;br /&gt;a=f;&lt;br /&gt;System.out.println(a.area());&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-5520052334603482207?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/5520052334603482207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-that-illustrates-how-run.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5520052334603482207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5520052334603482207'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-that-illustrates-how-run.html' title='Java program that illustrates how run time polymorphism is achieved'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8682884501010833047</id><published>2010-07-25T05:42:00.001-07:00</published><updated>2010-07-25T05:42:33.154-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java Program for calculator</title><content type='html'>JPanel p = new JPanel();&lt;br /&gt;p.setLayout(new GridLayout(4, 4));&lt;br /&gt;String buttons = “789/456*123-0.=+”;&lt;br /&gt;for (int i = 0; i &lt; buttons.length(); i++)&lt;br /&gt;addButton(p, buttons.substring(i, i + 1));&lt;br /&gt;add(p, “Center”);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-8682884501010833047?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8682884501010833047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-for-calculator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8682884501010833047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8682884501010833047'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-for-calculator.html' title='Java Program for calculator'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-4107893371436391622</id><published>2010-07-25T05:41:00.000-07:00</published><updated>2010-07-25T05:42:03.150-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java program to display a clock</title><content type='html'>background_ = new GSegment();&lt;br /&gt;GStyle backgroundStyle = new GStyle();&lt;br /&gt;backgroundStyle.setBackgroundColor (new Color (122, 136, 161));&lt;br /&gt;backgroundStyle.setForegroundColor (new Color (0, 0, 0));&lt;br /&gt;background_.setStyle (backgroundStyle);&lt;br /&gt;addSegment (background_);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-4107893371436391622?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/4107893371436391622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-display-clock.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4107893371436391622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4107893371436391622'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-display-clock.html' title='Java program to display a clock'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1197386180825901275</id><published>2010-07-25T05:40:00.002-07:00</published><updated>2010-07-25T05:41:31.036-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java program to display Local machines IP Address</title><content type='html'>import java.net.*;&lt;br /&gt;import java.io.*;&lt;br /&gt; &lt;br /&gt;public class ip_localmachine&lt;br /&gt;{&lt;br /&gt;public static void main(String args[]) throws Exception&lt;br /&gt;{&lt;br /&gt;InetAddress ipadd =InetAddress.getLocalHost();&lt;br /&gt;System.out.println("Host and Address :"+ipadd);&lt;br /&gt;System.out.println("Host name :"+ipadd.getHostName());&lt;br /&gt; &lt;br /&gt;String n=ipadd.toString();&lt;br /&gt;System.out.println("IP address :"+n.substring(n.indexOf("/")+1));&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/6660638602196740640-1197386180825901275?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1197386180825901275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-display-local-machines.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1197386180825901275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1197386180825901275'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-display-local-machines.html' title='Java program to display Local machines IP Address'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-2010207725308325486</id><published>2010-07-25T05:40:00.001-07:00</published><updated>2010-07-25T05:40:47.984-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java program that checks whether the given string is palindrome or not</title><content type='html'>StringBuffer s1=new StringBuffer(args[0]);&lt;br /&gt;StringBuffer s2=new StringBuffer(s1);&lt;br /&gt;s1.reverse();&lt;br /&gt;System.out.println(“Given String is:”+s2);&lt;br /&gt;System.out.println(“Reverse String is”+s1);&lt;br /&gt;Read More..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-2010207725308325486?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/2010207725308325486/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-that-checks-whether-given.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2010207725308325486'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2010207725308325486'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-that-checks-whether-given.html' title='Java program that checks whether the given string is palindrome or not'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-6217507449231512316</id><published>2010-07-25T05:39:00.000-07:00</published><updated>2010-07-25T05:40:01.603-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java Program to multiply two matrices</title><content type='html'>for(int j=i+1;j&lt;br /&gt;{&lt;br /&gt;if(names[i].compareTo(names[j])&lt;0)&lt;br /&gt;{&lt;br /&gt;temp=names[i];&lt;br /&gt;names[i]=names[j];&lt;br /&gt;names[j]=temp;&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/6660638602196740640-6217507449231512316?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/6217507449231512316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-multiply-two-matrices.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6217507449231512316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/6217507449231512316'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-multiply-two-matrices.html' title='Java Program to multiply two matrices'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8090160583653957014</id><published>2010-07-25T05:38:00.002-07:00</published><updated>2010-07-25T05:39:29.946-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java program that displays the number of characters, lines and words in a text file</title><content type='html'>while((c=isr.read())!=-1)&lt;br /&gt;{&lt;br /&gt;chars++;&lt;br /&gt;if(c==’\n’)&lt;br /&gt;lines++;&lt;br /&gt;if(c==’\t’ || c==’ ‘ || c==’\n’)&lt;br /&gt;++words;&lt;br /&gt;if(chars!=0)&lt;br /&gt;++chars;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-8090160583653957014?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8090160583653957014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-that-displays-number-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8090160583653957014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8090160583653957014'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-that-displays-number-of.html' title='Java program that displays the number of characters, lines and words in a text file'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-4557820543182683222</id><published>2010-07-25T05:38:00.001-07:00</published><updated>2010-07-25T05:38:56.573-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Java program to display Domain name service (DNS)</title><content type='html'>import java.net.*;&lt;br /&gt; &lt;br /&gt;class dns&lt;br /&gt;{&lt;br /&gt;public static void main(String args[]) throws Exception&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;InetAddress[] address=InetAddress.getAllByName("java.sun.com");&lt;br /&gt;for(int j=0;j&lt;address.length;j++)&lt;br /&gt;System.out.println(address[j]);&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;catch(Exception e)&lt;br /&gt;{&lt;br /&gt;System.out.println("Error in accessing Internet :"+e);&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/6660638602196740640-4557820543182683222?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/4557820543182683222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-display-domain-name.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4557820543182683222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/4557820543182683222'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/07/java-program-to-display-domain-name.html' title='Java program to display Domain name service (DNS)'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1588638260294535872</id><published>2010-06-02T07:59:00.000-07:00</published><updated>2010-06-02T08:10:16.623-07:00</updated><title type='text'>Bitwise Operators in java</title><content type='html'>class BitwiseOperators2 {&lt;br /&gt;  public static void main(String args[]) {&lt;br /&gt;    short s = 0xff;&lt;br /&gt;    System.out.println(s);&lt;br /&gt;    System.out.println(s &amp; 0xf);&lt;br /&gt;    System.out.println(s | 1);&lt;br /&gt;    System.out.println(s ^ 1);&lt;br /&gt;    System.out.println(~s);&lt;br /&gt;    System.out.println(s &gt;&gt; 2);&lt;br /&gt;    System.out.println(s &gt;&gt;&gt; 2);&lt;br /&gt;    System.out.println(s &lt;&lt; 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/6660638602196740640-1588638260294535872?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1588638260294535872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/06/bitwise-operators-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1588638260294535872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1588638260294535872'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/06/bitwise-operators-in-java.html' title='Bitwise Operators in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-2057632624084869939</id><published>2010-06-02T07:56:00.000-07:00</published><updated>2010-06-02T07:58:55.764-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Deadlock Demo in java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;class A&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  B b;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  synchronized void a1()&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    System.out.println("Starting a1");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    b.b2();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  synchronized void a2()&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    System.out.println("Starting a2");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class B&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  A a;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  synchronized void b1() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    System.out.println("Starting b1");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    a.a2();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  synchronized void b2() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    System.out.println("Starting b2");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Thread1 extends Thread {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  A a;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  Thread1(A a) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    this.a = a;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public void run() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    for(int i = 0; i &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      a.a1();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Thread2 extends Thread {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  B b;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  Thread2(B b) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    this.b = b;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public void run() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    for(int i = 0; i &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      b.b1();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class DeadlockDemo {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public static void main(String args[]) {&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    // Create objects&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    A a = new A();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    B b = new B();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    a.b = b;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    b.a = a;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    // Create threads&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Thread1 t1 = new Thread1(a);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Thread2 t2 = new Thread2(b);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    t1.start();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    t2.start();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    // Wait for threads to complete&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    try {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      t1.join();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      t2.join();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    catch(Exception e) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      e.printStackTrace();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    // Display message&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    System.out.println("Done!");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-2057632624084869939?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/2057632624084869939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/06/deadlock-demo-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2057632624084869939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2057632624084869939'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/06/deadlock-demo-in-java.html' title='Deadlock Demo in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8961746131375209257</id><published>2010-06-02T07:53:00.000-07:00</published><updated>2010-06-02T07:55:55.322-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Project of Bank Demo in java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Account2 {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private int balance;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  void deposit(int amount) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    synchronized(this) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      balance += amount;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int getBalance() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    return balance;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Customer2 extends Thread {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  Account2 account;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  Customer2(Account2 account) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    this.account = account;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public void run() {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    try {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      for(int i = 0; i &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        account.deposit(10);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    catch(Exception e) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      e.printStackTrace();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class BankDemo2 {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private final static int NUMCUSTOMERS = 10;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public static void main(String args[]) {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    // Create account&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Account2 account = new Account2();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    // Create and start customer threads&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Customer2 customers[] = new Customer2[NUMCUSTOMERS];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    for(int i = 0; i &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      customers[i] = new Customer2(account);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      customers[i].start();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    // Wait for customer threads to complete&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    for(int i = 0; i &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      try {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        customers[i].join();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      catch(InterruptedException e) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        e.printStackTrace();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;      }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    // Display account balance&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    System.out.println(account.getBalance());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-8961746131375209257?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8961746131375209257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/06/project-of-bank-demo-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8961746131375209257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8961746131375209257'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/06/project-of-bank-demo-in-java.html' title='Project of Bank Demo in java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-8764534541269944979</id><published>2010-04-06T06:49:00.000-07:00</published><updated>2010-04-06T06:50:14.054-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Projects'/><title type='text'>Standard and Scientific Calculator In Java</title><content type='html'>import java.awt.*;&lt;br /&gt;import java.awt.event.*;&lt;br /&gt;import javax.swing.*;&lt;br /&gt;import javax.swing.event.*;&lt;br /&gt;&lt;br /&gt;public class calculator extends JFrame implements ActionListener&lt;br /&gt;{&lt;br /&gt;        JTextField jtx;&lt;br /&gt;        double temp,temp1,result,a;&lt;br /&gt;        static double m1,m2;&lt;br /&gt;        int k=1,x=0,y=0,z=0;&lt;br /&gt;        char ch;&lt;br /&gt;        JButton&lt;br /&gt;one,two,three,four,five,six,seven,eight,nine,zero,clr,pow2,pow3,exp;&lt;br /&gt;        JButton&lt;br /&gt;plus,min,div,lg,rec,mul,eq,plmi,poin,mr,mc,mp,mm,sqrt,sin,cos,tan;&lt;br /&gt;        JMenuBar bar;&lt;br /&gt;        JMenu view;&lt;br /&gt;        JMenuItem exit;&lt;br /&gt;        JRadioButtonMenuItem standard,scientific;&lt;br /&gt;        JSeparator jp;&lt;br /&gt;        ButtonGroup bg;&lt;br /&gt;        Container cont;&lt;br /&gt;        JPanel textPanel,syntpanel,buttonpanel;&lt;br /&gt;        calculator()&lt;br /&gt;        {&lt;br /&gt;                cont=getContentPane();&lt;br /&gt;                cont.setLayout(new BorderLayout());&lt;br /&gt;                JPanel textpanel=new JPanel();&lt;br /&gt;                Font font=new Font("Arial",Font.PLAIN,18);&lt;br /&gt;                jtx=new JTextField(25);&lt;br /&gt;                jtx.setFont(font);&lt;br /&gt;                jtx.setHorizontalAlignment(SwingConstants.RIGHT);&lt;br /&gt;                jtx.addKeyListener(new KeyAdapter()&lt;br /&gt;                {&lt;br /&gt;                 public void keyTyped(KeyEvent keyevent)&lt;br /&gt;                 {&lt;br /&gt;                 char c=keyevent.getKeyChar();&lt;br /&gt;                 if(c&gt;='0' &amp;&amp; c&lt;='9')&lt;br /&gt;                 {&lt;br /&gt;                 }&lt;br /&gt;                 else&lt;br /&gt;                 {&lt;br /&gt;                 keyevent.consume();&lt;br /&gt;                 }&lt;br /&gt;                 }&lt;br /&gt;                 });&lt;br /&gt;                textpanel.add(jtx);&lt;br /&gt;                buttonpanel=new JPanel();&lt;br /&gt;                buttonpanel.setLayout(new GridLayout(5,4,2,2));&lt;br /&gt;                boolean t=true;&lt;br /&gt;                syntpanel=new JPanel();&lt;br /&gt;                syntpanel.setLayout(new GridLayout(5,1));&lt;br /&gt;                bar=new JMenuBar();&lt;br /&gt;                view=new JMenu("View");&lt;br /&gt;&lt;br /&gt;                standard =new JRadioButtonMenuItem("Standard",true);&lt;br /&gt;                standard.setMnemonic('S');&lt;br /&gt;                standard.addItemListener(new radiohandler());&lt;br /&gt;                scientific =new JRadioButtonMenuItem("Sceintific");&lt;br /&gt;                standard.setMnemonic('c');&lt;br /&gt;                scientific.addItemListener(new radiohandler());&lt;br /&gt;                jp=new JSeparator();&lt;br /&gt;                exit=new JMenuItem("Exit");&lt;br /&gt;                standard.setMnemonic('E');&lt;br /&gt;                exit.addActionListener(this);&lt;br /&gt;                bg=new ButtonGroup();&lt;br /&gt;                bg.add(standard);&lt;br /&gt;                bg.add(scientific);&lt;br /&gt;                view.add(standard);&lt;br /&gt;                view.add(scientific);&lt;br /&gt;                view.add(jp);&lt;br /&gt;                view.add(exit);&lt;br /&gt;                bar.add(view);&lt;br /&gt;                setJMenuBar(bar);&lt;br /&gt;&lt;br /&gt;                mr=new JButton("MR");&lt;br /&gt;                buttonpanel.add(mr);&lt;br /&gt;                mr.addActionListener(this);&lt;br /&gt;                seven=new JButton("7");&lt;br /&gt;                buttonpanel.add(seven);&lt;br /&gt;                seven.addActionListener(this);&lt;br /&gt;                eight=new JButton("8");&lt;br /&gt;                buttonpanel.add(eight);&lt;br /&gt;                eight.addActionListener(this);&lt;br /&gt;                nine=new JButton("9");&lt;br /&gt;                buttonpanel.add(nine);&lt;br /&gt;                nine.addActionListener(this);&lt;br /&gt;                clr=new JButton("AC");&lt;br /&gt;                buttonpanel.add(clr);&lt;br /&gt;                clr.addActionListener(this);&lt;br /&gt;&lt;br /&gt;                mc=new JButton("MC");&lt;br /&gt;                buttonpanel.add(mc);&lt;br /&gt;                mc.addActionListener(this);&lt;br /&gt;                four=new JButton("4");&lt;br /&gt;                buttonpanel.add(four);&lt;br /&gt;                four.addActionListener(this);&lt;br /&gt;                five=new JButton("5");&lt;br /&gt;                buttonpanel.add(five);&lt;br /&gt;                five.addActionListener(this);&lt;br /&gt;                six=new JButton("6");&lt;br /&gt;                buttonpanel.add(six);&lt;br /&gt;                six.addActionListener(this);&lt;br /&gt;                mul=new JButton("*");&lt;br /&gt;                buttonpanel.add(mul);&lt;br /&gt;                mul.addActionListener(this);&lt;br /&gt;&lt;br /&gt;                mp=new JButton("M+");&lt;br /&gt;                buttonpanel.add(mp);&lt;br /&gt;                mp.addActionListener(this);&lt;br /&gt;                one=new JButton("1");&lt;br /&gt;                buttonpanel.add(one);&lt;br /&gt;                one.addActionListener(this);&lt;br /&gt;                two=new JButton("2");&lt;br /&gt;                buttonpanel.add(two);&lt;br /&gt;                two.addActionListener(this);&lt;br /&gt;                three=new JButton("3");&lt;br /&gt;                buttonpanel.add(three);&lt;br /&gt;                three.addActionListener(this);&lt;br /&gt;                min=new JButton("-");&lt;br /&gt;                buttonpanel.add(min);&lt;br /&gt;                min.addActionListener(this);&lt;br /&gt;&lt;br /&gt;                mm=new JButton("M-");&lt;br /&gt;                buttonpanel.add(mm);&lt;br /&gt;                mm.addActionListener(this);&lt;br /&gt;                zero=new JButton("0");&lt;br /&gt;                buttonpanel.add(zero);&lt;br /&gt;                zero.addActionListener(this);&lt;br /&gt;                plmi=new JButton("+/-");&lt;br /&gt;                buttonpanel.add(plmi);&lt;br /&gt;                plmi.addActionListener(this);&lt;br /&gt;                poin=new JButton(".");&lt;br /&gt;                buttonpanel.add(poin);&lt;br /&gt;                poin.addActionListener(this);&lt;br /&gt;                plus=new JButton("+");&lt;br /&gt;                buttonpanel.add(plus);&lt;br /&gt;                plus.addActionListener(this);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                rec=new JButton("1/x");&lt;br /&gt;                buttonpanel.add(rec);&lt;br /&gt;                rec.addActionListener(this);&lt;br /&gt;                sqrt=new JButton("Sqrt");&lt;br /&gt;                buttonpanel.add(sqrt);&lt;br /&gt;                sqrt.addActionListener(this);&lt;br /&gt;                lg=new JButton("log");&lt;br /&gt;                buttonpanel.add(lg);&lt;br /&gt;                lg.addActionListener(this);&lt;br /&gt;                div=new JButton("/");&lt;br /&gt;                div.addActionListener(this);&lt;br /&gt;                buttonpanel.add(div);&lt;br /&gt;                eq=new JButton("=");&lt;br /&gt;                buttonpanel.add(eq);&lt;br /&gt;                eq.addActionListener(this);&lt;br /&gt;&lt;br /&gt;                sin=new JButton("SIN");&lt;br /&gt;                syntpanel.add(sin);&lt;br /&gt;                sin.addActionListener(this);&lt;br /&gt;                cos=new JButton("COS");&lt;br /&gt;                syntpanel.add(cos);&lt;br /&gt;                cos.addActionListener(this);&lt;br /&gt;                tan=new JButton("TAN");&lt;br /&gt;                syntpanel.add(tan);&lt;br /&gt;                tan.addActionListener(this);&lt;br /&gt;                pow2=new JButton("x^2");&lt;br /&gt;                syntpanel.add(pow2);&lt;br /&gt;                pow2.addActionListener(this);&lt;br /&gt;                pow3=new JButton("x^3");&lt;br /&gt;                syntpanel.add(pow3);&lt;br /&gt;                pow3.addActionListener(this);&lt;br /&gt;                exp=new JButton("Exp");&lt;br /&gt;                exp.addActionListener(this);&lt;br /&gt;&lt;br /&gt;                cont.add("Center",buttonpanel);&lt;br /&gt;                cont.add("North",textpanel);&lt;br /&gt;                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;        }&lt;br /&gt;class radiohandler implements ItemListener&lt;br /&gt;{&lt;br /&gt;public void itemStateChanged(ItemEvent ie)&lt;br /&gt;  {&lt;br /&gt;        AbstractButton button=(AbstractButton)ie.getItem();&lt;br /&gt;        String label=button.getText();&lt;br /&gt;        {&lt;br /&gt;          if(label.equals("Standard"))&lt;br /&gt;          {&lt;br /&gt;                cont.remove(syntpanel);&lt;br /&gt;                validate();&lt;br /&gt;          }&lt;br /&gt;        if(label.equals("Sceintific"))&lt;br /&gt;          {&lt;br /&gt;                cont.add("West",syntpanel);&lt;br /&gt;                validate();&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;public void actionPerformed(ActionEvent e)&lt;br /&gt;{&lt;br /&gt;        String s=e.getActionCommand();&lt;br /&gt;        if(s.equals("Exit"))&lt;br /&gt;        {&lt;br /&gt;                System.exit(0);&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("1"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"1");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"1");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("2"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"2");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"2");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("3"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"3");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"3");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("4"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"4");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"4");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("5"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"5");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"5");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("6"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"6");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"6");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("7"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"7");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"7");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("8"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"8");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"8");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("9"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"9");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"9");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("0"))&lt;br /&gt;        {&lt;br /&gt;        if(z==0)&lt;br /&gt;        {&lt;br /&gt;        jtx.setText(jtx.getText()+"0");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        jtx.setText(jtx.getText()+"0");&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("AC"))&lt;br /&gt;        {&lt;br /&gt;        jtx.setText("");&lt;br /&gt;        x=0;&lt;br /&gt;        y=0;&lt;br /&gt;        z=0;&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("log"))&lt;br /&gt;        {&lt;br /&gt;           if(jtx.getText().equals(""))&lt;br /&gt;             {&lt;br /&gt;                 jtx.setText("");&lt;br /&gt;             }&lt;br /&gt;           else&lt;br /&gt;          {&lt;br /&gt;                a=Math.log(Double.parseDouble(jtx.getText()));&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                jtx.setText(jtx.getText() + a);&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("1/x"))&lt;br /&gt;        {&lt;br /&gt;           if(jtx.getText().equals(""))&lt;br /&gt;             {&lt;br /&gt;                 jtx.setText("");&lt;br /&gt;             }&lt;br /&gt;           else&lt;br /&gt;             {&lt;br /&gt;                  a=1/Double.parseDouble(jtx.getText());&lt;br /&gt;                  jtx.setText("");&lt;br /&gt;                  jtx.setText(jtx.getText() + a);&lt;br /&gt;             }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("Exp"))&lt;br /&gt;        {&lt;br /&gt;          if(jtx.getText().equals(""))&lt;br /&gt;            {&lt;br /&gt;                 jtx.setText("");&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                 a=Math.exp(Double.parseDouble(jtx.getText()));&lt;br /&gt;                 jtx.setText("");&lt;br /&gt;                 jtx.setText(jtx.getText() + a);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("x^2"))&lt;br /&gt;        {&lt;br /&gt;          if(jtx.getText().equals(""))&lt;br /&gt;           {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;           }&lt;br /&gt;           else&lt;br /&gt;           {&lt;br /&gt;               a=Math.pow(Double.parseDouble(jtx.getText()),2);&lt;br /&gt;               jtx.setText("");&lt;br /&gt;               jtx.setText(jtx.getText() + a);&lt;br /&gt;           }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("x^3"))&lt;br /&gt;        {&lt;br /&gt;          if(jtx.getText().equals(""))&lt;br /&gt;          {&lt;br /&gt;              jtx.setText("");&lt;br /&gt;          }&lt;br /&gt;          else&lt;br /&gt;          {&lt;br /&gt;              a=Math.pow(Double.parseDouble(jtx.getText()),3);&lt;br /&gt;              jtx.setText("");&lt;br /&gt;              jtx.setText(jtx.getText() + a);&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("+/-"))&lt;br /&gt;        {&lt;br /&gt;         if(x==0)&lt;br /&gt;         {&lt;br /&gt;              jtx.setText("-"+jtx.getText());&lt;br /&gt;         x=1;&lt;br /&gt;         }&lt;br /&gt;         else&lt;br /&gt;         {&lt;br /&gt;              jtx.setText(jtx.getText());&lt;br /&gt;         }&lt;br /&gt;         }&lt;br /&gt;        if(s.equals("."))&lt;br /&gt;        {&lt;br /&gt;         if(y==0)&lt;br /&gt;         {&lt;br /&gt;         jtx.setText(jtx.getText()+".");&lt;br /&gt;         y=1;&lt;br /&gt;         }&lt;br /&gt;         else&lt;br /&gt;         {&lt;br /&gt;         jtx.setText(jtx.getText());&lt;br /&gt;         }&lt;br /&gt;         }&lt;br /&gt;        if(s.equals("+"))&lt;br /&gt;        {&lt;br /&gt;          if(jtx.getText().equals(""))&lt;br /&gt;           {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                temp=0;&lt;br /&gt;                ch='+';&lt;br /&gt;           }&lt;br /&gt;        else&lt;br /&gt;           {&lt;br /&gt;                temp=Double.parseDouble(jtx.getText());&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                ch='+';&lt;br /&gt;                y=0;&lt;br /&gt;                x=0;&lt;br /&gt;           }&lt;br /&gt;           jtx.requestFocus();&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("-"))&lt;br /&gt;        {&lt;br /&gt;          if(jtx.getText().equals(""))&lt;br /&gt;           {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                temp=0;&lt;br /&gt;                ch='-';&lt;br /&gt;           }&lt;br /&gt;          else&lt;br /&gt;           {&lt;br /&gt;                x=0;&lt;br /&gt;                y=0;&lt;br /&gt;                temp=Double.parseDouble(jtx.getText());&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                ch='-';&lt;br /&gt;           }&lt;br /&gt;             jtx.requestFocus();&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("/"))&lt;br /&gt;        {&lt;br /&gt;          if(jtx.getText().equals(""))&lt;br /&gt;           {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                temp=1;&lt;br /&gt;                ch='/';&lt;br /&gt;           }&lt;br /&gt;        else&lt;br /&gt;           {&lt;br /&gt;                x=0;&lt;br /&gt;                y=0;&lt;br /&gt;                temp=Double.parseDouble(jtx.getText());&lt;br /&gt;                ch='/';&lt;br /&gt;                jtx.setText("");&lt;br /&gt;           }&lt;br /&gt;            jtx.requestFocus();&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("*"))&lt;br /&gt;        {&lt;br /&gt;          if(jtx.getText().equals(""))&lt;br /&gt;           {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                temp=1;&lt;br /&gt;                ch='*';&lt;br /&gt;           }&lt;br /&gt;        else&lt;br /&gt;           {&lt;br /&gt;                x=0;&lt;br /&gt;                y=0;&lt;br /&gt;                temp=Double.parseDouble(jtx.getText());&lt;br /&gt;                ch='*';&lt;br /&gt;                jtx.setText("");&lt;br /&gt;           }&lt;br /&gt;            jtx.requestFocus();&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("MC"))&lt;br /&gt;          {&lt;br /&gt;                m1=0;&lt;br /&gt;                jtx.setText("");&lt;br /&gt;          }&lt;br /&gt;        if(s.equals("MR"))&lt;br /&gt;        {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                jtx.setText(jtx.getText() + m1);&lt;br /&gt;        }&lt;br /&gt;        if(s.equals("M+"))&lt;br /&gt;           {&lt;br /&gt;                if(k==1)&lt;br /&gt;                {&lt;br /&gt;                m1=Double.parseDouble(jtx.getText());&lt;br /&gt;                k++;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                m1+=Double.parseDouble(jtx.getText());&lt;br /&gt;                jtx.setText(""+m1);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        if(s.equals("M-"))&lt;br /&gt;           {&lt;br /&gt;                if(k==1)&lt;br /&gt;                {&lt;br /&gt;                m1=Double.parseDouble(jtx.getText());&lt;br /&gt;                k++;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                m1-=Double.parseDouble(jtx.getText());&lt;br /&gt;                jtx.setText(""+m1);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            if(s.equals("Sqrt"))&lt;br /&gt;            {&lt;br /&gt;                if(jtx.getText().equals(""))&lt;br /&gt;                {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                a=Math.sqrt(Double.parseDouble(jtx.getText()));&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                jtx.setText(jtx.getText() + a);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            if(s.equals("SIN"))&lt;br /&gt;            {&lt;br /&gt;                if(jtx.getText().equals(""))&lt;br /&gt;                {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                a=Math.sin(Double.parseDouble(jtx.getText()));&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                jtx.setText(jtx.getText() + a);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            if(s.equals("COS"))&lt;br /&gt;            {&lt;br /&gt;                if(jtx.getText().equals(""))&lt;br /&gt;                {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                a=Math.cos(Double.parseDouble(jtx.getText()));&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                jtx.setText(jtx.getText() + a);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            if(s.equals("TAN"))&lt;br /&gt;            {&lt;br /&gt;                if(jtx.getText().equals(""))&lt;br /&gt;                {&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                a=Math.tan(Double.parseDouble(jtx.getText()));&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                jtx.setText(jtx.getText() + a);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        if(s.equals("="))&lt;br /&gt;       {&lt;br /&gt;         if(jtx.getText().equals(""))&lt;br /&gt;         {&lt;br /&gt;              jtx.setText("");&lt;br /&gt;         }&lt;br /&gt;         else&lt;br /&gt;         {&lt;br /&gt;         temp1 = Double.parseDouble(jtx.getText());&lt;br /&gt;         switch(ch)&lt;br /&gt;         {&lt;br /&gt;                case '+':&lt;br /&gt;                result=temp+temp1;&lt;br /&gt;                break;&lt;br /&gt;                case '-':&lt;br /&gt;                result=temp-temp1;&lt;br /&gt;                break;&lt;br /&gt;                case '/':&lt;br /&gt;                result=temp/temp1;&lt;br /&gt;                break;&lt;br /&gt;                case '*':&lt;br /&gt;                result=temp*temp1;&lt;br /&gt;                break;&lt;br /&gt;           }&lt;br /&gt;                jtx.setText("");&lt;br /&gt;                jtx.setText(jtx.getText() + result);&lt;br /&gt;                z=1;&lt;br /&gt;         }&lt;br /&gt;         }&lt;br /&gt;         jtx.requestFocus();&lt;br /&gt;  }&lt;br /&gt;public static void main(String args[])&lt;br /&gt;        {&lt;br /&gt;                calculator n=new calculator();&lt;br /&gt;                n.setTitle("CALCULATOR");&lt;br /&gt;                n.setSize(370,250);&lt;br /&gt;                n.setResizable(false);&lt;br /&gt;                n.setVisible(true);&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/6660638602196740640-8764534541269944979?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/8764534541269944979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/04/standard-and-scientific-calculator-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8764534541269944979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/8764534541269944979'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/04/standard-and-scientific-calculator-in.html' title='Standard and Scientific Calculator In Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-2794760547051783158</id><published>2010-04-06T06:45:00.000-07:00</published><updated>2010-04-06T06:47:53.163-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Projects'/><title type='text'>School Management System Project In Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;//Case Study&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.util.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import javax.swing.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import javax.swing.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class ProjectX extends JFrame implements ChangeListener,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ActionListener&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  static int choice = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  static String line = "--------------------------------";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  DataInputStream inputData = new DataInputStream(System.in);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private Registration studentDetails = new Registration();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int topScore = studentDetails.getTopScore();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int passMarks = studentDetails.getPassMarks();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int firstClass = studentDetails.getFirstClass();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int secondClass = studentDetails.getSecondClass();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTabbedPane tabbedPane = new JTabbedPane();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JLabel statusLabel = new JLabel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JLabel titleLabel = new JLabel("Student Software Beta Edition");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JPanel addStudentPanel = new JPanel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextField studentName = new JTextField();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextField physicsMarks = new JTextField();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextField biologyMarks = new JTextField();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextField mathsMarks = new JTextField();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JButton submitDetails = new JButton("Submit Details");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JPanel studentDetailsPanel = new JPanel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextField studentID1 = new JTextField();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextArea studentInfo = new JTextArea();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JButton submitID1 = new JButton("Submit ID");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JPanel studentGradePanel = new JPanel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextField studentID2 = new JTextField();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextArea studentGrade = new JTextArea();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JButton submitID2 = new JButton("Submit ID");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JPanel numberPassedPanel = new JPanel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextArea studentPassed = new JTextArea();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JPanel classTopperPanel = new JPanel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  JTextArea studentTopper = new JTextArea();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public ProjectX(String frameTitle)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  super(frameTitle);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  setResizable(true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  setSize(400,400);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  submitDetails.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  submitID1.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  submitID2.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  getContentPane().setLayout(new BorderLayout());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  getContentPane().add(titleLabel,"North");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  tabbedPane.addTab("Add Student",addStudentPanel);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.setLayout(new GridLayout(8,2,5,5));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.add(new JLabel("Student Name: "));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.add(studentName);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.add(new JLabel("Physics Marks: "));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.add(physicsMarks);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.add(new JLabel("Biology Marks: "));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.add(biologyMarks);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.add(new JLabel("Maths Marks: "));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.add(mathsMarks);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  addStudentPanel.add(submitDetails);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  tabbedPane.addTab("Student Details",studentDetailsPanel);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentDetailsPanel.add(new JLabel("Enter Student ID: "));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentDetailsPanel.add(studentID1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentDetailsPanel.add(submitID1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentDetailsPanel.add(new JLabel("Student Details:"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentDetailsPanel.add(studentInfo);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  tabbedPane.addTab("Student Grade",studentGradePanel);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentGradePanel.setLayout(new GridLayout(5,2,5,5));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentGradePanel.add(new JLabel("Enter Student ID: "));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentGradePanel.add(studentID2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentGradePanel.add(submitID2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentGradePanel.add(new JLabel("Student Grade:"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentGradePanel.add(studentGrade);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  tabbedPane.addTab("Passed Student",numberPassedPanel);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  numberPassedPanel.setLayout(new GridLayout(2,2,5,5));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  numberPassedPanel.add(new JLabel("Number of Student Passed: "));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  numberPassedPanel.add(studentPassed);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  tabbedPane.addTab("Class Topper",classTopperPanel);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  classTopperPanel.setLayout(new GridLayout(2,2,5,5));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  classTopperPanel.add(new JLabel("Here are the class Toppers: "));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  classTopperPanel.add(studentTopper);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  tabbedPane.addChangeListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  getContentPane().add(tabbedPane,"Center");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  statusLabel.setText("Status: Normal");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  getContentPane().add(statusLabel,"South");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  setVisible(true);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  ProjectX outputScreen = new ProjectX("Case Study");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public String setStudentInfo()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int id = studentDetails.addStudent(studentName.getText(),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Integer.parseInt(physicsMarks.getText()),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Integer.parseInt(biologyMarks.getText()),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Integer.parseInt(mathsMarks.getText()));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;(" "  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  line  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "Record Created For " + studentName +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;"  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "Student ID: " + id  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;"  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  line  );&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public String getStudentInfo()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int id = Integer.parseInt(studentID1.getText());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(studentDetails.getStudentDetails(id))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return  ("&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;"  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  line  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "Student Details&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;"  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  line  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "Student ID:" + "    " + id + "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;"  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "Student Name:" + "    " + studentDetails.studentName + "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;"  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "Physics Marks:" + "    " + studentDetails.physicsMarks + "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;" +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "Biology Marks:" + "    " + studentDetails.biologyMarks + "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;" +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  "Maths Marks:" + "    " + studentDetails.mathsMarks + "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;"  +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  line  );&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return("&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; Records Not Found for ID " + id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public String getStudentGrade()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int id = Integer.parseInt(studentID2.getText());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentDetails.getStudentDetails(id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  String grade;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(studentDetails.studentName == null)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.out.println("&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; Records Not Found for ID " + id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return null;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(studentDetails.physicsMarks &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;studentDetails.biologyMarks &lt;&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;passMarks)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  grade = "Failed";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int avgMarks = (studentDetails.physicsMarks +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;studentDetails.biologyMarks + studentDetails.mathsMarks)/3;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(avgMarks &gt;= passMarks &amp;amp;&amp;amp; avgMarks &lt; grade =" "&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Class";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  else if(avgMarks &gt;= secondClass &amp;amp;&amp;amp; avgMarks &lt; grade ="&lt;/span"&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;"Second Class";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  else if(avgMarks &gt;= firstClass &amp;amp;&amp;amp; avgMarks &lt; grade =" "&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Class";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  else grade = "Distinction";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return(line + "Grade For " + studentDetails.studentName + " is " + grade&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;+ "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;" + line);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public String getNumberPasses()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int lastID = Registration.getNextID() -1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  boolean passed = true;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int numberPassed = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  for(int id = 1; id &lt;= lastID; id++)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentDetails.getStudentDetails(id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(studentDetails.physicsMarks &gt;= passMarks &amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;studentDetails.biologyMarks &gt;= passMarks &amp;amp;&amp;amp; studentDetails.mathsMarks &gt;=&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;passMarks) numberPassed++;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return(line + "Number of Student Passed: " + numberPassed + "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;" +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;line);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public String getClassTopper()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int lastID = Registration.getNextID() -1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  String classTopper;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  StringBuffer buffer = new StringBuffer(500);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int topMarks = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  for(int id = 1; id &lt;= lastID; id++)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentDetails.getStudentDetails(id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int studentMarks = studentDetails.physicsMarks +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;studentDetails.biologyMarks + studentDetails.mathsMarks;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(studentMarks &gt; topMarks) topMarks = studentMarks;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  buffer.append(line + "Student Having Top Marks: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  for(int id = 1; id &lt;= lastID; id++)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentDetails.getStudentDetails(id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int studentMarks = studentDetails.physicsMarks +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;studentDetails.biologyMarks + studentDetails.mathsMarks;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(studentMarks == topMarks)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  buffer.append(studentDetails.studentName + " Having Total Marks: " +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;topMarks + "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  buffer.append(line);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return(buffer.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public void stateChanged(ChangeEvent e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  switch(tabbedPane.getSelectedIndex())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  case 3: studentPassed.setText(getNumberPasses());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  case 4: studentTopper.setText(getClassTopper());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public void actionPerformed(ActionEvent e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(e.getSource() == submitID1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentInfo.setText(getStudentInfo());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  else if(e.getSource() == submitID2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentGrade.setText(getStudentGrade());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(e.getSource() == submitDetails)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  setStudentInfo();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//Registration Class&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class Registration&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private int topScore = 90;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private int passMarks = 35;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private int firstClass = 65;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private int secondClass = 45;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private static String idFile = "id.dat";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  private static String studentFile = "stdfile.dat";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public int id;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public String studentName;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public int physicsMarks;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public int biologyMarks;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public int mathsMarks;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public int addStudent(String studentName, int physicsMarks, int&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;biologyMarks, int mathsMarks)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int id = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  FileWriter fileOutput = new FileWriter(Registration.studentFile,true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  id = Registration.getNextID();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  String buffer = id + "|" + studentName + "|" + physicsMarks + "|" +&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;biologyMarks + "|" + mathsMarks + "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  fileOutput.write(buffer);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  fileOutput.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  Registration.setID(id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  catch(IOException e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.err.println(e.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.exit(1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return id;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//Function to get the details of a student given the ID&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public boolean getStudentDetails(int id)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  FileReader fileInput = new FileReader(Registration.studentFile);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  BufferedReader br = new BufferedReader(fileInput);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  String str;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  while((str = br.readLine()) != null)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  StringTokenizer fields = new StringTokenizer(str,"|");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(Integer.parseInt(fields.nextToken()) == id)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  this.id = id;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  this.studentName = fields.nextToken();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  this.physicsMarks = Integer.parseInt(fields.nextToken());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  this.biologyMarks = Integer.parseInt(fields.nextToken());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  this.mathsMarks = Integer.parseInt(fields.nextToken());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return true;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  catch(IOException e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.err.println(e.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.exit(1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return false;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public int getTopScore()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return topScore;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public int getPassMarks()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return passMarks;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public int getFirstClass()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return firstClass;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public int getSecondClass()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return secondClass;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//Function to get the next ID available&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public static int getNextID()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  int id = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  RandomAccessFile studentIDFile = new&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;RandomAccessFile(Registration.idFile,"rw");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  if(studentIDFile.length() == 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  id = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  else id = studentIDFile.readInt();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  id++;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentIDFile.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  catch(IOException e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.err.println(e.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.exit(1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  return id;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//Function to Store current ID in a file&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  public static void setID(int id)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  RandomAccessFile studentIDFile = new&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;RandomAccessFile(Registration.idFile,"rw");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentIDFile.seek(0);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentIDFile.writeInt(id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  studentIDFile.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  catch(IOException e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.err.println(e.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.exit(1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            &lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-2794760547051783158?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/2794760547051783158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/04/school-management-system-project-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2794760547051783158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/2794760547051783158'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/04/school-management-system-project-in.html' title='School Management System Project In Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1503251527844106232</id><published>2010-04-06T06:44:00.000-07:00</published><updated>2010-04-06T06:45:02.129-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to Set the foreground and background color to the text area in Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.applet.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class colopat extends Frame&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Checkbox r,g,b;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Checkbox m,y,gr,p,w,bl,c;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    TextArea ta;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Checkbox r1,g1,b1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Checkbox m1,y1,gr1,p1,w1,bl1,c1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Label ba,fo;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    Panel pa1,p2,p3;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    colopat()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        setSize(800,600);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        setLayout(new BorderLayout());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1=new Panel(new GridLayout(5,2,10,10));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2=new Panel(new GridLayout(5,2,10,10));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        CheckboxGroup cbg=new CheckboxGroup();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        r=new Checkbox("red",cbg,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        g=new Checkbox("green",cbg,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        b=new Checkbox("blue",cbg,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        m=new Checkbox("megenta",cbg,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        y=new Checkbox("yellow",cbg,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        gr=new Checkbox("grey",cbg,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p=new Checkbox("pink",cbg,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        w=new Checkbox("white",cbg,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        bl=new Checkbox("black",cbg,true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        c=new Checkbox("cyan",cbg,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        ba=new Label("BACKGROUND COLORS",Label.CENTER);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        ba.setBackground(Color.pink);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(ba);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(r);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(b);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(m);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(gr);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(p);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(w);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(bl);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        pa1.add(c);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        add("West",pa1);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        ta=new TextArea(5,25);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p3=new Panel(new GridLayout(3,1));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p3.add(new Label("Text Area",1));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p3.add(ta);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        add("Center",p3);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        r.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        g.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        b.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        m.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        y.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        gr.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        w.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        c.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        bl.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        CheckboxGroup cbg1=new CheckboxGroup();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        r1=new Checkbox("red",cbg1,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        g1=new Checkbox("green",cbg1,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        b1=new Checkbox("blue",cbg1,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        m1=new Checkbox("megenta",cbg1,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        y1=new Checkbox("yellow",cbg1,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        gr1=new Checkbox("grey",cbg1,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p1=new Checkbox("pink",cbg1,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        w1=new Checkbox("white",cbg1,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        bl1=new Checkbox("black",cbg1,true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        c1=new Checkbox("cyan",cbg1,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        fo=new Label("FOREGROUND COLORS");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        fo.setBackground(Color.pink);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(fo);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(c1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(g1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(b1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(m1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(y1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(gr1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(p1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(w1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(bl1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p2.add(c1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        add("East",p2);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        r1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        g1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        b1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        m1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        y1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        gr1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        p1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        w1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        c1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        bl1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        c1.addItemListener(new CheckBoxHandler(this));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        addWindowListener(new mywindowAdapter(this));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        setVisible(true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        new colopat();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class CheckBoxHandler implements ItemListener&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; colopat cp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;CheckBoxHandler(colopat cp)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; this.cp=cp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void itemStateChanged(ItemEvent ie)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(cp.r.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.red);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.g.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.green);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.b.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.blue);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.m.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.magenta);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.y.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.yellow);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.gr.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.lightGray);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.bl.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.black);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.w.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.white);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.p.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.pink);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setBackground(Color.cyan);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(cp.r1.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.red);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.g1.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.green);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.b1.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.blue);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.m1.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.magenta);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.y1.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.yellow);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.gr1.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.lightGray);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.bl1.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.black);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.w1.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.white);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(cp.p1.getState())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.pink);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cp.ta.setForeground(Color.cyan);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class mywindowAdapter extends WindowAdapter&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; colopat cp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;mywindowAdapter(colopat cp)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt; this.cp=cp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosing(WindowEvent e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;  System.exit(0);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;            &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-1503251527844106232?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1503251527844106232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/04/program-to-set-foreground-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1503251527844106232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1503251527844106232'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/04/program-to-set-foreground-and.html' title='Program to Set the foreground and background color to the text area in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-195559699904643454</id><published>2010-04-06T06:01:00.000-07:00</published><updated>2010-04-06T06:06:24.149-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to convert numbers in a file to corresponding words.</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.lang.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class NumToWords&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        public static void main(String a[]) throws IOException&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String s="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                BufferedReader br=new BufferedReader(new InputStreamReader(System.in));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                System.out.print("Enter filename : ");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        s=br.readLine();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }catch(Exception e){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                InputStream in=new FileInputStream(s);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                MyInputStream mis=new MyInputStream(in);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                mis.changeNumbers();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                in.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                mis.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class MyInputStream extends FilterInputStream&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        InputStream is;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        MyInputStream(InputStream in)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                super(in);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                is=in;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        public void changeNumbers() throws IOException&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                PushbackInputStream pis;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String num="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                char ch;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                int c;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                pis=new PushbackInputStream(is);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                while((c=pis.read())!=-1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        ch=(char)c;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        if('0'&lt;=ch&amp;amp;&amp;amp;ch&lt;='9')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                num="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                while('0'&lt;=ch&amp;amp;&amp;amp;ch&lt;='9'&amp;amp;&amp;amp;c!=-1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                        num=num+ch;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                        c=pis.read();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                        ch=(char)c;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                System.out.print(MyInputStream.process(num));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                pis.unread(ch);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                System.out.print(ch);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        static String process(String str)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String a1[]={"One","Two","Three","Four","Five","Six","Seven","Eight","Nine"};&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String a2[]={"Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninety"};&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String a3[]={"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"};&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String a4[]={"Hundered","Thousand","Lakhs","Crores"};&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                int num=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        num=Integer.parseInt(str);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }catch(Exception e){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                if(num==0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        return "Zero";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                int n,n1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String ans="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String ans1="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                n1=num%10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                num=num/10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                if(n1!=0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        ans=a1[n1-1];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                if(num&gt;0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        n=num%10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        num=num/10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        if(n==1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                ans=a3[n1];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        else if(n!=0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                ans=a2[n-2]+" "+ans;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                if(num&gt;0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        n=num%10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        num=num/10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        if(n!=0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                ans=a1[n-1]+" "+a4[0]+" "+ans;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                for(int i=1;num&gt;0;i++)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        n1=num%10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        num=num/10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        if(n1!=0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                ans1=a1[n1-1];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        if(num&gt;0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                n=num%10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                num=num/10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                if(n==1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                        ans1=a3[n1];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                else if(n!=0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                        ans1=a2[n-2]+" "+ans1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        ans=ans1+" "+a4[i]+" "+ans;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        ans1="";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                return(ans);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-195559699904643454?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/195559699904643454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/04/program-to-convert-numbers-in-file-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/195559699904643454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/195559699904643454'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/04/program-to-convert-numbers-in-file-to.html' title='Program to convert numbers in a file to corresponding words.'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-3389807629449767936</id><published>2010-04-06T05:59:00.000-07:00</published><updated>2010-04-06T06:01:02.957-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Assignments'/><title type='text'>Program to counting number of Chars, Words and Lines in a given file in Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.lang.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.util.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class WordCount&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        public static void main(String arg[]) throws Exception&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                int char_count=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                int word_count=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                int line_count=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                String s;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                StringTokenizer st;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                System.out.print("Enter filename : ");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                s=buf.readLine();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                buf=new BufferedReader(new FileReader(s));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                while((s=buf.readLine())!=null)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        line_count++;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        st=new StringTokenizer(s," ,;:.");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        while(st.hasMoreTokens())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                word_count++;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                s=st.nextToken();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                                char_count+=s.length();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                System.out.println("Character Count : "+char_count);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                System.out.println("Word Count : "+word_count);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                System.out.println("Line Count : "+line_count);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;                buf.close();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-3389807629449767936?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/3389807629449767936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/04/program-to-counting-number-of-chars.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3389807629449767936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/3389807629449767936'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/04/program-to-counting-number-of-chars.html' title='Program to counting number of Chars, Words and Lines in a given file in Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-5769788061181914553</id><published>2010-04-05T09:43:00.000-07:00</published><updated>2010-04-05T09:44:22.472-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Projects'/><title type='text'>student management system Project In Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.applet.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.sql.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class menu extends Frame implements&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;WindowListener,ActionListener&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;MenuBar mb;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;MenuItem student,rollnowise,namewise,allresult;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static menu m;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;rollnowise rw;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;namewise n;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;student st;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int x,y,d;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public menu()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;super("menu ARPAN");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;addWindowListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;x=y=700;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;d=10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setSize(x,y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setBackground(Color.orange);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;addMenu();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static void main(String args[])&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;m=new menu();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void addMenu()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;MenuBar mb=new MenuBar();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Menu register=new Menu("REGISTER");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Menu inquery=new Menu("INQUERY");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;register.add("STUDENT");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;register.add("EXIT");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;inquery.add("ROLLNOWISE");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;inquery.add("NAMEWISE");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;mb.add(register);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;mb.add(inquery);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setMenuBar(mb);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;register.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;inquery.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String arg=ae.getActionCommand();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(ae.getSource() instanceof Menu)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(arg.equals("EXIT"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.exit(0);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(ae.getSource() instanceof Menu)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("STUDENT".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st=new student();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(ae.getSource() instanceof Menu)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("ROLLNOWISE".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;rw=new rollnowise();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;rw.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(ae.getSource() instanceof Menu)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("NAMEWISE".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;n=new namewise();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;n.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosed(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowDeiconified(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowIconified(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowActivated(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowDeactivated(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowOpened(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosing(WindowEvent we)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;while(x&gt;0 &amp;amp;&amp;amp; y&gt;0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setSize(x,y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;x=x-d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;y=y-d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.out.println("mail me at arpankumarsingh@yahoo.com");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dispose();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;System.exit(0);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//class for name wise report&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class namewise extends Frame implements WindowListener,ActionListener&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static namewise nw;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l1=new Label("NAME",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l2=new Label("ROLLNO",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l3=new Label("COLG",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l4=new Label("SUB1",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l5=new Label("SUB2",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l6=new Label("SUB3",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l7=new Label("SUB4",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l8=new Label("SUB5",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_entername=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button but_entername =new Button("FIND");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button ok=new Button("OK");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Graphics g;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String sqlstr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Statement st;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;GridLayout gl=new GridLayout(1,2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;GridLayout cl=new GridLayout(1,5);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Font font18=new Font("VinetaBT",Font.BOLD|Font.ITALIC,18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int x,y,d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Dialog dlg;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label msg;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public namewise()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;super("NAMEWISE");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;addWindowListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setLayout(new GridLayout(12,1));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setBackground(Color.orange);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setForeground(Color.black);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;addMenu();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;x=550;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;y=450;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;d=100;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setSize(x,y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void addMenu()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p4=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l11=new Label("ENTERNAME");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(l11);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(tf_entername);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(but_entername);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p4);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;but_entername.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ok.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//Dialog for confirmation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg=new Dialog(this,"Inventory Management System",false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.setLayout(new GridLayout(2,1));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.setSize(100,100);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.setLocation(200,100);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ok.setSize(50,50);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;msg=new Label("NAME NOT FOUND");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.add(msg);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.add(ok);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void actionPerformed(ActionEvent e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p1=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l1.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l2.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.setLayout(gl);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.add(l1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.add(l2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;g=getGraphics();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;g.drawLine(40,0,40,0);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p2=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l3.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p2.add(l3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p2.setLayout(gl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p3=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l4.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l5.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l6.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l7.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l8.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l5);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l6);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l7);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l8);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.setLayout(cl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String arg=e.getActionCommand();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(e.getSource() instanceof Button)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("FIND".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Connection&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;con=DriverManager.getConnection("jdbc:odbc:stu","","");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sqlstr="select * from stu1 where NAME='"+&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_entername.getText()+"'";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st=con.createStatement();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ResultSet rs;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;rs= st.executeQuery(sqlstr);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;while(rs.next())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel a1=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l1=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l2=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l1.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l2.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a1.setLayout(gl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel a2=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l3=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l3.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a2.setLayout(gl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel a3=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l4=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l5=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l6=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l7=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l8=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l4.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l5.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l6.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l7.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l8.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.setLayout(cl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l1.setText(rs.getString("NAME"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l2.setText(""+rs.getInt("ROLLNO"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l3.setText(rs.getString("COLG"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l4.setText(""+rs.getInt("SUB1"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l5.setText(""+rs.getInt("SUB2"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l6.setText(""+rs.getInt("SUB3"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l7.setText(""+rs.getInt("SUB4"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l8.setText(""+rs.getInt("SUB5"));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a1.add(l1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a1.add(l2);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a2.add(l3);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l5);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l6);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l7);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l8);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(a1);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(a2);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(a3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(ClassNotFoundException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_entername.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(SQLException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_entername.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosed(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowDeiconified(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowIconified(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowActivated(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowDeactivated(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowOpened(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosing(WindowEvent we)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;while(x&gt;0 &amp;amp;&amp;amp; y&gt;0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setSize(x,y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;x=x-d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;y=y-d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dispose();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//class for rollnowise report&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class rollnowise extends Frame implements&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;WindowListener,ActionListener&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static rollnowise rw;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l1=new Label("NAME",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l2=new Label("ROLLNO",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l3=new Label("COLG",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l4=new Label("SUB1",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l5=new Label("SUB2",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l6=new Label("SUB3",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l7=new Label("SUB4",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l8=new Label("SUB5",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_entername=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button but_entername =new Button("FIND");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String sqlstr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Statement st;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;GridLayout gl=new GridLayout(1,2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;GridLayout cl=new GridLayout(1,5);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Font font18=new Font("VinetaBT",Font.BOLD|Font.ITALIC,18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int x,y,d;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public rollnowise()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;super("ROLLNOWISE");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;addWindowListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setLayout(new GridLayout(12,1));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setBackground(Color.orange);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setForeground(Color.black);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;addMenu();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;x=550;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;y=450;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;d=100;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setSize(x,y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void addMenu()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p4=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l11=new Label("ENTERROLLNO");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(l11);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(tf_entername);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(but_entername);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p4);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;but_entername.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void actionPerformed(ActionEvent e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p1=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l1.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l2.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.setLayout(gl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.add(l1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.add(l2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l3.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p2=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p2.add(l3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p2.setLayout(gl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p3=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l4.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l5.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l6.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l7.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l8.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l5);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l6);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l7);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(l8);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.setLayout(cl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;/* Panel p4=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l11=new Label("ENTERROLLNO");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(l11);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(tf_entername);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(but_entername);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String arg=e.getActionCommand();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(e.getSource() instanceof Button)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("FIND".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Connection&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;con=DriverManager.getConnection("jdbc:odbc:stu","","");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sqlstr="select * from stu1 where ROLLNO="+&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_entername.getText()+"";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st=con.createStatement();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ResultSet rs;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;rs= st.executeQuery(sqlstr);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;while(rs.next())&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel a1=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l1=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l2=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l1.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l2.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a1.setLayout(gl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel a2=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l3=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l3.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a2.setLayout(gl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel a3=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l4=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l5=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l6=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l7=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l8=new Label("",Label.LEFT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l4.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l5.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l6.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l7.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l8.setFont(font18);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.setLayout(cl);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l1.setText(rs.getString("NAME"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l2.setText(""+rs.getInt("ROLLNO"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l3.setText(rs.getString("COLG"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l4.setText(""+rs.getInt("SUB1"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l5.setText(""+rs.getInt("SUB2"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l6.setText(""+rs.getInt("SUB3"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l7.setText(""+rs.getInt("SUB4"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;l8.setText(""+rs.getInt("SUB5"));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a1.add(l1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a1.add(l2);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a2.add(l3);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l5);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l6);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l7);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a3.add(l8);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(a1);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(a2);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(a3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(ClassNotFoundException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_entername.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(SQLException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_entername.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosed(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowDeiconified(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowIconified(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowActivated(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowDeactivated(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowOpened(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosing(WindowEvent we)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;while(x&gt;0 &amp;amp;&amp;amp; y&gt;0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setSize(x,y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;x=x-d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;y=y-d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dispose();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//class which help in storing records in the database&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class student extends Frame implements ActionListener,WindowListener&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public static student st;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_name=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_rollno=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_colg=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_marks=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_sub1=new TextField(4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_sub2=new TextField(4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_sub3=new TextField(4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_sub4=new TextField(4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField tf_sub5=new TextField(4);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l2=new Label("ROLLNO");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l1=new Label("NAME");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l3=new Label("MARKS");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l4=new Label("COLG");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l5=new Label("MARK SHEET");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l6=new Label("SUB1");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l7=new Label("SUB2");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l8=new Label("SUB3");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l9=new Label("SUB4");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label l10=new Label("SUB5");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button but_add=new Button("ADD");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button but_edit=new Button("EDIT");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button but_find=new Button("FIND");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button but_delete=new Button("DELETE");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button but_cancel=new Button("CANCEL");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button ok=new Button("OK");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Dialog dlg;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label msg;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int x,y,d;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public student()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;super("palce");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;addWindowListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setLayout(new GridLayout(6,1));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setBackground(Color.yellow);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setVisible(true);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;addmenu();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;x=550;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;y=450;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;d=12;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setSize(x,y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;void addmenu()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//GridLayout gl=new GridLayout();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p1=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.add(l1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.add(tf_name);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.add(l2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p1.add(tf_rollno);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p2=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p2.add(l5);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p3=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(but_add);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(but_find);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(but_cancel);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(but_edit);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p3.add(but_delete);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p4=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//p4.add(l3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(l6);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(l7);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(l8);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(l9);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p4.add(l10);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p8=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p8.add(tf_sub1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p8.add(tf_sub2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p8.add(tf_sub3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p8.add(tf_sub4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p8.add(tf_sub5);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Panel p5=new Panel();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p5.add(l4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;p5.add(tf_colg);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p5);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p4);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p8);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(p3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;but_add.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;but_cancel.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;but_find.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;but_delete.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;but_edit.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ok.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//Dialog for confirmation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg=new Dialog(this,"Inventory Management System",false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.setLayout(new GridLayout(2,1));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.setSize(100,100);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.setLocation(200,100);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ok.setSize(50,50);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;msg=new Label("Record Updated");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.add(msg);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.add(ok);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void actionPerformed(ActionEvent e)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String arg=e.getActionCommand();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//ADDBUTTON&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(e.getSource() instanceof Button)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("ADD".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Connection con=DriverManager.getConnection("jdbc:odbc:stu","","");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Statement st;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String sqlStr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sqlStr="insert into&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;stu1(NAME,ROLLNO,COLG,SUB1,SUB2,SUB3,SUB4,SUB5)values('"+tf_name.getText()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;+"',"+tf_rollno.getText()+",'"+tf_colg.getText()+"',"+tf_sub1.getText()+",&lt;br /&gt;+tf_sub2.getText()+"," +tf_sub3.getText()+","+tf_sub4.getText()+","+tf_sub&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;5.getText()+")";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st=con.createStatement();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st.executeUpdate(sqlStr);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(ClassNotFoundException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;// tf_name.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;msg.setText("ERROR");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(SQLException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;// tf_name.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;msg.setText("ENTER TEXTFIELD");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//OK button&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if ( e.getSource() instanceof Button)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if ("OK".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{ dlg.dispose();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//CANCEL&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(e.getSource() instanceof Button)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("CANCEL".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_name.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_rollno.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_colg.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub1.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub2.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub3.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub4.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub5.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//FIND&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(e.getSource() instanceof Button)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("FIND".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Connection con=DriverManager.getConnection("jdbc:odbc:stu","","");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Statement st;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String sqlstr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sqlstr="select * from stu1 where ROLLNO ="+tf_rollno.getText()+"";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st=con.createStatement();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ResultSet rs;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;rs=st.executeQuery(sqlstr);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;rs.next();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_name.setText(""+rs.getString("NAME"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_colg.setText(""+rs.getString("COLG"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub1.setText(""+rs.getInt("SUB1"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub2.setText(""+rs.getInt("SUB2"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub3.setText(""+rs.getInt("SUB3"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub4.setText(""+rs.getInt("SUB4"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub5.setText(""+rs.getInt("SUB5"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(ClassNotFoundException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;msg.setText("RECORD NOT FOUND");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.show();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;// tf_name.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(SQLException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;msg.setText("RECORD NOT FOUND");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//tf_name.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//DELETE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(e.getSource() instanceof Button)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("DELETE".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Connection con=DriverManager.getConnection("jdbc:odbc:stu","","");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Statement st;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String sqlstr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sqlstr="delete * from stu1 where ROLLNO="+tf_rollno.getText()+"";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st=con.createStatement();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st.executeUpdate(sqlstr);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_name.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_colg.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub1.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub2.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub3.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub4.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_sub5.setText("");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_rollno.setText("");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;msg.setText("RECORD DELETED");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.show();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(ClassNotFoundException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_name.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(SQLException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_name.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;//EDIT&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(e.getSource() instanceof Button)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if("EDIT".equals(arg))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;try&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Connection con=DriverManager.getConnection("jdbc:odbc:stu","","");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Statement st;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;String sqlstr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sqlstr="update stu1 set&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;NAME='"+tf_name.getText()+"',SUB1="+tf_sub1.getText()+",SUB2="+tf_sub2.get&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Text()+",SUB3="+tf_sub3.getText()+",SUB4="+tf_sub4.getText()+",SUB5="+tf_s&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ub5.getText()+",COLG='"+tf_colg.getText()+"' where&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ROLLNO="+tf_rollno.getText();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st=con.createStatement();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;st.executeUpdate(sqlstr);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;msg.setText("RECORD UPDATED");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dlg.show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(ClassNotFoundException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_name.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;catch(SQLException se)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;tf_name.setText("Error : " + se.toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosed(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowDeiconified(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowIconified(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowActivated(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowDeactivated(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowOpened(WindowEvent we){}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosing(WindowEvent we)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;while(x&gt;0 &amp;amp;&amp;amp; y&gt;0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setSize(x,y);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;x=x-d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;y=y-d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;show();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;dispose();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-5769788061181914553?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/5769788061181914553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/04/student-management-system-project-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5769788061181914553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/5769788061181914553'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/04/student-management-system-project-in.html' title='student management system Project In Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-1633538475830000613</id><published>2010-04-05T09:38:00.000-07:00</published><updated>2010-04-05T09:39:08.633-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Projects'/><title type='text'>Project of Employee payroll managemnt system In Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.Color.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.applet.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;/*&lt;applet code="train2.class" height="300" width="600"&gt;&lt;/applet&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class train2 extends Applet implements&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ActionListener,ItemListener&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label name,amount,seats,number;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField na,am,sts,nr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextArea t;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Choice css;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Checkbox si,sr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;CheckboxGroup g;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button b,cancel;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int s,c,d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int n1=400;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int n2=250;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int n3=100;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void init()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setBackground(Color.yellow);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setForeground(Color.red);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setLayout(new FlowLayout());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;na=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;am=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sts=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;nr=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;name=new Label("NAME");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;amount=new Label("AMOUNT");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;seats=new Label("SEATS");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;number=new Label("REQUIRED NO OF SEATS");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css=new Choice();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.add("A.C SLEEPER");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.add("FIRST CLASS");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.add("SECOND CLASS");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;t=new TextArea(40,45);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;g=new CheckboxGroup();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;si=new Checkbox("SATAPTI",g,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sr=new Checkbox("SABARI",g,false);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;b=new Button("SUBMIT");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cancel=new Button("CANCEL");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(name);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(na);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(seats);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(sts);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(number);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(nr);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(si);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(sr);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(css);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(b);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(amount);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(am);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(t);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(cancel);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.addItemListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;b.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;si.addItemListener (this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sr.addItemListener (this);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(b.getActionCommand().equals("SUBMIT"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;d=Integer.parseInt(nr.getText());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;s=(Integer.parseInt(sts.getText()))-d;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(css.getSelectedItem().equals("A.C SLEEPER"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;am.setText("400");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(css.getSelectedItem().equals("FIRST CLASS"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;am.setText("250");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;am.setText("100");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;c=((Integer.parseInt(am.getText()))*(Integer.parseInt(nr.getText())));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;t.setText("NAME:"+na.getText()+"&lt;br /&gt;+"After reservation total no.of&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;seats are:"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;+s+"&lt;br /&gt;+"Train name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;:"+g.getSelectedCheckbox().getLabel()+"&lt;br /&gt;+"Class:"+&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.getSelectedItem()+ "Total number of Rs :"+c);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(cancel.getActionCommand().equals("CANCEL"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;repaint();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void itemStateChanged(ItemEvent ie)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.Color.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.applet.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;/*&lt;applet code="train2.class" height="300" width="600"&gt;&lt;/applet&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class train2 extends Applet implements&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ActionListener,ItemListener&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label name,amount,seats,number;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextField na,am,sts,nr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;TextArea t;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Choice css;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Checkbox si,sr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;CheckboxGroup g;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Button b,cancel;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int s,c,d;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int n1=400;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int n2=250;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;int n3=100;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void init()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setBackground(Color.yellow);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setForeground(Color.red);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;setLayout(new FlowLayout());&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;na=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;am=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sts=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;nr=new TextField(20);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;name=new Label("NAME");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;amount=new Label("AMOUNT");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;seats=new Label("SEATS");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;number=new Label("REQUIRED NO OF SEATS");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css=new Choice();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.add("A.C SLEEPER");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.add("FIRST CLASS");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.add("SECOND CLASS");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;t=new TextArea(40,45);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;g=new CheckboxGroup();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;si=new Checkbox("SATAPTI",g,false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sr=new Checkbox("SABARI",g,false);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;b=new Button("SUBMIT");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;cancel=new Button("CANCEL");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(name);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(na);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(seats);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(sts);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(number);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(nr);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(si);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(sr);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(css);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(b);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(amount);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(am);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(t);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;add(cancel);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.addItemListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;b.addActionListener(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;si.addItemListener (this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sr.addItemListener (this);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void actionPerformed(ActionEvent ae)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(b.getActionCommand().equals("SUBMIT"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;d=Integer.parseInt(nr.getText());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;s=(Integer.parseInt(sts.getText()))-d;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(css.getSelectedItem().equals("A.C SLEEPER"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;am.setText("400");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else if(css.getSelectedItem().equals("FIRST CLASS"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;am.setText("250");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;am.setText("100");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;c=((Integer.parseInt(am.getText()))*(Integer.parseInt(nr.getText())));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;t.setText("NAME:"+na.getText()+"&lt;br /&gt;+"After reservation total no.of&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;seats are:"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;+s+"&lt;br /&gt;+"Train name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;:"+g.getSelectedCheckbox().getLabel()+"&lt;br /&gt;+"Class:"+&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;css.getSelectedItem()+ "Total number of Rs :"+c);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;if(cancel.getActionCommand().equals("CANCEL"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;repaint();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void itemStateChanged(ItemEvent ie)&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6660638602196740640-1633538475830000613?l=lernjava.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernjava.blogspot.com/feeds/1633538475830000613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://lernjava.blogspot.com/2010/04/project-of-employee-payroll-managemnt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1633538475830000613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6660638602196740640/posts/default/1633538475830000613'/><link rel='alternate' type='text/html' href='http://lernjava.blogspot.com/2010/04/project-of-employee-payroll-managemnt.html' title='Project of Employee payroll managemnt system In Java'/><author><name>Pop's World</name><uri>http://www.blogger.com/profile/04964875113190825498</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-6660638602196740640.post-2221654820108536106</id><published>2010-04-05T09:37:00.000-07:00</published><updated>2010-04-05T09:38:15.368-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Projects'/><title type='text'>BANKING MANAGEMENT Project In Java</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.io.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.applet.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;import java.awt.event.*;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;/*&lt;applet code="bang2.class" width="300" height="400"&gt;&lt;/applet&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class frame1 extends Frame&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;frame1(String title)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;super(title);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;MyWindowAdapter ad=new MyWindowAdapter(this);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;addWindowListener(ad);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void paint(Graphics g)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;g.drawString("This is a frame Window",10,40);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;class MyWindowAdapter extends WindowAdapter&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;frame1 f1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public MyWindowAdapter(frame1 f1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;this.f1=f1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public void windowClosing(WindowEvent we)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;f1.setVisible(false);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;public class bang2 extends Applet implements&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ActionListener,ItemListener&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Label customer,deposit,accno,widthdraw;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt
