Sunday, June 17, 2012


Some of the Best Moments in Life

* To fall in love.
* To find mails by the thousands when you return from a vacation.
* To go for a vacation to some pretty place.
* To listen to your favorite song in the radio.
* To go to bed and to listen while it rains outside.
* To leave the! shower and find that the towel is warm.
* To clear your last exam.
* To receive a call from someone, you don't see a lot, but you want to.
* To find money in a pant that you haven't used since last year .
* To laugh at yourself looking at mirror, making faces.:)))
* To laugh without a reason.
* To accidentally hear somebody say something good about you.
* To wake up and realize it is still possible to sleep for a couple of hours.
* To hear a song that makes you remember a special person.
* To be part of a team.
* To watch the sunset from the hill top.
* To make new friends.
* To feel butterflies! in the stomach every time that you see that person.
* To use a sweater of the person that you like and find that it still smells of their perfume.
* To take an evening walk along the beach.
* To have somebody tell you that he/she loves you.
* To laugh .......laugh. .......and laugh ...... remembering stupid things done with stupid friends.

These are the best moments of life....☺ ♥♥♥ ☺

God's Coffee


A group of alumni, highly established in their careers, got together to visit their old university professor. Conversation soon turned into complaints about stress in work and life.

Offering his guests coffee, the professor went to the kitchen and returned with a large pot of coffee and an assortment of cups - porcelain, plastic, glass, crystal, some plain looking, some
expensive, some exquisite - telling them to help themselves to the coffee.

When all the students had a cup of coffee in hand, the professor said:

"If you noticed, all the nice looking expensive cups were taken up, leaving behind the plain and cheap ones. While it is normal for you to want only the best for yourselves, that is the source of your problems and stress.

Be assured that the cup itself adds no quality to the coffee. In most cases it is just more expensive and in some cases even hides what we drink.

What all of you really wanted was coffee, not the cup, but you consciously went for the best cups... And then you began eyeing each other's cups.

Now consider this: Life is the coffee; the jobs, money and position in society are the cups. They are just tools to hold and contain Life, and the type of cup we have does not define, nor change the quality of Life we live.

Sometimes, by concentrating only on the cup, we fail to enjoy the coffee God has provided us."

God brews the coffee, not the cups.......... Enjoy your coffee!

"The happiest people don't have the best of everything. They just make the best of everything."

 Live simply. Love generously. Care deeply. Speak kindly. Leave the rest to God. :-)

Wednesday, May 9, 2012

Connection using Oracle

import java.sql.*;
public class DBDemo
{
  public static void main(String arg[])
  {
    ResultSet rs;
    try
{
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   Connection con=DriverManager.getConnection("jdbc:odbc:HostString","scott","tiger");
   Statement stmt=con.createStatement();
   stmt.executeUpdate("insert into tblStu values (50,'Physics','India')");
   System.out.println("Inserted successfullly");
}
    catch(Exception e)
{}
  }
}
Display all records from Employee table:

import java.sql.*;
import java.io.*;
import java.util.*;
public class JavaDataBase
{
   public static void main(String a[])
   {
       try
       {
           Class.for.Name("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con=DriverManager.getConnection("jdbc:odbc:empdsn");
           Statement stmt=con.createStatement();
           ResultSet rset=stmt.executeQuery("select * from employee");
          while(rset.next())
          {
              System.out.println("Empno"+rset.getInt("empno")+"\t");
              System.out.println("Name"+rset.getString("empname")+"\t");
              System.out.println("Salary"+rset.getInt("empsalary")+"\t");
          }
       }
       catch(Exception e)
       {
           e.printStackTrace();
       }
  }
}

Saturday, January 28, 2012

JAVA ASS@ 8

Qus 1:


/*1st ques solution*/
import java.io.*;
class Shape
{
void area()
{
System.out.println("No area for shape");
}
}
class circle extends Shape
{
float r;
circle(float r1)
{
r=r1;
}
void area()
{
float ar;
ar=r*r*3.14f;
System.out.println("Area of circle="+ar);
}
}
class rect extends Shape
{
float len,br;
rect(float l,float b)
{
len=l;
br=b;
}
void area()
{
float ar;
ar=len*br;
System.out.println("Area of rectangle="+ar);
}
}
class Dynamic
{
public static void main(String arg[])
{
Shape s1=new Shape();
circle c=new circle(5.3f);
rect r=new rect(4.5f,5.6f);

Shape s;
s=s1;
s.area();
s=c;
s.area();
s=r;
s.area();
}
}

=================


Que 2 :


/*2nd que solution*/ class Simple { int a,b; Simple(int a1,int b1) { a=a1; b=b1; } void add() { int c; c=a+b; System.out.println("Sum="+c); } void add(int a1,int b1) { int c; c=a1+b1; System.out.println("Sum="+c); } } class Overload { public static void main(String arg[]) { Simple ob=new Simple(2,5); ob.add(); ob.add(10,20); } }


================


Que 3 :


/*3rd que solution*/ class Electricity { int unit; float cost; Electricity(int u,float c) { unit=u; cost=c; } void display() { System.out.println("Unit="+unit); System.out.println("Cost="+cost); } void cal() { float t; t=unit*cost; System.out.println("Elec Bill="+t); } } class Phone extends Electricity { int unit; float cost; Phone(int u1,float c1,int u2,float c2) { super(u1,c1); unit=u2; cost=c2; } void disp() { System.out.println("Unit="+unit); System.out.println("Cost="+cost); } void calculate() { super.cal(); System.out.println("Phone Bill="+(unit*cost)); } } class SuperDemo { public static void main(String arg[]) { Phone ph=new Phone(5,3.5f,3,5.7f); ph.display(); ph.disp(); ph.calculate(); } }
========


Que 4 ;


/*4th que solution*/ class Domestic { int unit; float cost; Domestic(int u,float c) { unit=u; cost=c; } void display() { System.out.println("Unit="+unit); System.out.println("Cost="+cost); } void calculate() { float t; t=unit*cost; System.out.println("Elec Bill="+t); } } class Commercial extends Domestic { int unit; float cost; Commercial(int u1,float c1,int u2,float c2) { super(u1,c1); unit=u2; cost=c2; } void display() { super.display(); System.out.println("Unit="+unit); System.out.println("Cost="+cost); } void calculate() { super.calculate(); System.out.println("Commercial Bill="+(unit*cost)); } } class OverrideDemo { public static void main(String arg[]) { Commercial ob=new Commercial(5,3.5f,3,5.7f); ob.display(); ob.calculate(); } }


======


Que 5:




/*5th que solution*/ import java.io.*; abstract class Bank { String name; int ano; float bal; void read() { DataInputStream sd=new DataInputStream(System.in); try { BufferedReader br=new BufferedReader (new InputStreamReader(System.in)); System.out.println("Enter Name:"); name=br.readLine(); System.out.println("Enter account no:"); ano=Integer.parseInt(br.readLine()); System.out.println("Enter Balance:"); bal=Float.parseFloat(br.readLine()); } catch(Exception e) {} } void deposit() { float d; try { BufferedReader br=new BufferedReader (new InputStreamReader(System.in)); System.out.println("Enter Amount:"); d=Float.parseFloat(br.readLine()); bal=bal+d; System.out.println("Balance="+bal); } catch(Exception e) {} } abstract void withdraw(float amount); } class Bankaccess extends Bank { void withdraw(float amount) { try { if(bal-1000<amount) System.out.println("Cant withdraw"); else { bal=bal-amount; System.out.println("Balance="+bal); } } catch(Exception e) {} } } class MainDemo1 { public static void main(String arg[])throws IOException { Bankaccess ob=new Bankaccess(); String ch; float w; ob.read(); BufferedReader br=new BufferedReader (new InputStreamReader(System.in)); System.out.println("Want to withdraw or deposit...(w/d)"); ch=br.readLine(); if(ch.equals("w")) { System.out.println("Enter Amount:"); w=Float.parseFloat(br.readLine()); ob.withdraw(w); } else if(ch.equals("d")) ob.deposit(); else System.out.println("Wrong Entry"); } }