Buscar

Saturday, 30 April 2011

// write a program of JDBC ODBC connectivity through ms access which prints the record one by one.


CODE

import java.sql.*;
class Database
{
public static void main(String args[])throws
Exception
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:nitin");
Statement st=con.createStatement();
ResultSet res=st.executeQuery("select * from Student");
while(res.next())
{
System.out.println(res.getInt(1)+" "+res.getString(2)+" "+res.getString(3)+" "+res.getString(4));
}
}
}

OUTPUT DISPLAY










// write a program in java which concatenate two string.


CODE

import java.io.*;
public class CombinString{
public static void main(String[] args) throws IOException{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter First String:");
String str1 = bf.readLine();
System.out.println("Enter Second String:");
String str2 = bf.readLine();
System.out.println("CONCATINATE TWO STRING!");
String com = str1.concat(str2);
System.out.println("CONCATINATE STRING: " + com);
}
}

OUTPUT DISPLAY






// write a program in java which finds the index of a particular character the string.


CODE

import java.io.*;
import java.awt.*;
public class StringIndex
{
public static void main(String args[])
{
String s = "Welcome to BCA";
System.out.println(s);
System.out.println("INDEX OF 'B' IN THE STRING IS=" + s.indexOf("BCA"));
}


OUTPUT DISPLAY







// write a program which counts the length of the string.

CODE



import java.lang.*;

import java.io.*;
public class StringLength{
public static void main(String[] args) throws IOException{
System.out.println("String lenght example!");
BufferedReader bf = new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Please enter string:");
String str = bf.readLine();
int len = str.length();
System.out.println("String lenght : " + len);
}
}


OUTPUT DISPLAY



// write a program in java which initialize the object of class through parameterized constructor.

CODE


class a
{
a( )
{
System.out.println("In a\'s Contructor...");
}
}
class b extends a
{
b(String s)
{
System.out.println("In b\'s constructor...");
System.out.println(s);
}
}
public class par
{
public static void main(String [ ]args)
{
b obj=new b("Hello from java!");
}
}

OUTPUT DISPLAY



// write a program in java which converts a lower case to upper case string.


CODE 

import java.io.*;
import java.lang.*;
class UpperCase
{
public static void main(String args[ ]) throws IOException
{
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the lowercase character : ");
String s = buff.readLine();
System.out.println("Upper case of "+s +" is "+s.toUpperCase());
}
}

OUTPUT DISPLAY


// write a program in java to compare two strings whether equal or not.

CODE



import java.lang.*;
import java.io.*;
public class CompString{
public static void main(String[] args) throws IOException{
System.out.println("String equals or not example!");
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter first string:");
String str1 = bf.readLine();
System.out.println("Please enter second string:");
String str2 = bf.readLine();
if (str1.equals(str2)){
System.out.println("The given string is equals");
}
else
{
System.out.println("The given string is not equals");
}
}
}

OUT[UT DISPLAY


// write a program to handle divide by zero exception.


CODE

class Dividebyzero
{
public static void main(String s[])
{
int a =10;
int b =5;
int c =5;
int x;
try
{
x =a/(b-c);
}
catch(ArithmeticException e)
{
System.out.println("divisle by zero"+e);
}
}
}

OUTPUT DISPLAY


// write a program in java using buffer reader to read the name entered through keyboard by the user.


CODE
import java.io.*;
public class Hi
{
public static void main(String[] args) throws IOException
{
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.print("Enter your name: ");
String name = input.readLine();
System.out.println("Hi," + name + "!");
}
}


OUTPUT DISPLAY





// program in java using awt control label and button to select a value of label.


CODE

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class value extends Applet implements ActionListener
{
Label l1;
Button b1;
public void init( )
{
l1= new Label("Hello");
add(l1);
b1= new Button("Show");
add(b1);
b1.addActionListener (this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
String s=l1.getText();
System.out.println(s);
}
}
}

HTML CODE
<HTML>
<BODY>
<APPLET ALIGN="CENTER" CODE="AppletSum.class" width = "700" height = "400"></APPLET>
</BODY>
</HTML>

OUTPUT DISPLAY



// write a program in java using buffer reader to read the name entered through keyboard by the user.

CODE



import java.io.*;
public class Hi
{
public static void main(String[] args) throws IOException
{
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.print("Enter your name: ");
String name = input.readLine();
System.out.println("Hi," + name + "!");
}
}

OUTPUT DISPLAY


// write a program in java using awt control label and button to select a value of label.

CODE

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class value extends Applet implements ActionListener
{
Label l1;
Button b1;
public void init( )
{
l1= new Label("Hello");
add(l1);
b1= new Button("Show");
add(b1);
b1.addActionListener (this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
String s=l1.getText();
System.out.println(s);
}
}
}


HTML CODE
<HTML>
<BODY>
<APPLET ALIGN="CENTER" CODE="AppletSum.class" width = "700" height = "400"></APPLET>
</BODY>
</HTML>

OUTPUT DISPLAY


// program in java using awt control label and text field in which user inputs the value to the text field.


CODE

import java.applet.Applet;
import java.awt.Button;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class AnonymouseButton extends Applet {
TextField txtSource;
Button btnToLOwer;
public void init()
{
txtSource=new TextField(20);
btnToLOwer=new Button("Lower Case");
btnToLOwer.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
String tmp=txtSource.getText();
tmp=tmp.toLowerCase();
txtSource.setText(tmp);
}});
add(txtSource);
add(btnToLOwer);
}
}

HTML CODE

<HTML>
<BODY>
<APPLET ALIGN="CENTER" CODE=" AnonymouseButton.java" width = "700" height = "400"></APPLET>
</BODY>
</HTML>

OUTPUT DISPLAY




// Write a program in java in which derived class uses attributes of base class.


CODE

class Overload
{
public void test(int a) {
System.out.println("a: " + a);
}
void test(int a, int b) {
System.out.println("a and b: " + a + "," + b);
}
double test(double a) {
System.out.println("double a: " + a);
return a*a; }
}
class Over extends Overload {
void test(int a, int b) {
System.out.println("a and b: " + a + "," + b); }
}
class MethodOverloading {
public static void main(String args[]) {
Over overload = new Over();
double result;
overload.test(10);
overload.test(10, 20);
result = overload.test(5.5);
System.out.println("Result : " + result);
}
}

OUTPUT DISPLAY


// write a program in java in which two threads are prioritized.


CODE

class MyThread1 extends Thread{
MyThread1(String s){
super(s);
start();
}
public void run(){
for(int i=0;i<3;i++){
Thread cur=Thread.currentThread();
cur.setPriority(Thread.MIN_PRIORITY);
int p=cur.getPriority();
System.out.println("Thread Name  :"+Thread.currentThread().getName());
System.out.println("Thread Priority  :"+cur);
}
}
}
class MyThread2 extends Thread{
MyThread2(String s){
super(s);
start();
}
public void run(){
for(int i=0;i<3;i++){
Thread cur=Thread.currentThread();
cur.setPriority(Thread.MAX_PRIORITY);
int p=cur.getPriority();
System.out.println("Thread Name  :"+Thread.currentThread().getName());
System.out.println("Thread Priority  :"+cur);
}
}
}
public class ThreadPriority{
public static void main(String args[]){
MyThread1 m1=new MyThread1("My Thread 1");
MyThread2 m2=new MyThread2("My Thread 2");
}
}

OUTPUT DISPLAY







Friday, 29 April 2011

// To calculate for multiply 2 numbers by using applet.


CODE

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class AppletMul extends Applet implements ActionListener{
TextField text1,text2,output;
Label label1,label2,label3;
Button button;
public void init(){
setLayout(null);
label1 = new Label("Enter Number1: ");
label1.setBounds(20,20,100,20);
add(label1);
text1 = new TextField(5);
text1.setBounds(150,20,100,20);
add(text1);
label2 = new Label("Enter Number2: ");
label2.setBounds(20,50,100,20);
add(label2);
text2 = new TextField(5);
text2.setBounds(150,50,100,20);
add(text2);
label3 = new Label("Mul of Two Numbers: ");
label3.setBounds(20,80,130,20);
add(label3);
output = new TextField(5);
output.setBounds(150,80,100,20);
add(output);
button = new Button("Mul");
button.setBounds(150,110,100,20);
add(button);
button.addActionListener(this);
}
public void actionPerformed(ActionEvent ae){
int num1=Integer.parseInt(text1.getText());
int num2=Integer.parseInt(text2.getText());
int Mul=num1*num2;
output.setText(Integer.toString(Mul));
}
}

HTML CODE

<HTML>
<BODY>
<APPLET ALIGN="CENTER" CODE="AppletSum.class" width = "700" height = "400"></APPLET>
</BODY>
</HTML>


 OUTPUT DISPLAY



// To calculate for adding 2 numbers by using applet.


CODE

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class AppletSub extends Applet implements ActionListener
{
TextField text1,text2,output;
Label label1,label2,label3;
Button button;
public void init()
{
setLayout(null);
label1 = new Label("Enter Number1: ");
label1.setBounds(20,20,100,20);
add(label1);
text1 = new TextField(5);
text1.setBounds(150,20,100,20);
add(text1);
label2 = new Label("Enter Number2: ");
label2.setBounds(20,50,100,20);
add(label2);
text2 = new TextField(5);
text2.setBounds(150,50,100,20);
add(text2);
label3 = new Label("Sub of Two Numbers: ");
label3.setBounds(20,80,130,20);
add(label3);
output = new TextField(5);
output.setBounds(150,80,100,20);
add(output);
button = new Button("Sub");
button.setBounds(150,110,100,20);
add(button);
button.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
int num1=Integer.parseInt(text1.getText());
int num2=Integer.parseInt(text2.getText());
int sub=num1-num2;
output.setText(Integer.toString(sub));
}
}

HTML CODE

<HTML>
<BODY>
<APPLET ALIGN="CENTER" CODE="AppletSum.class" width = "700" height = "400"></APPLET>
</BODY>
</HTML>

OUTPUT DISPLAY


// Menu Bar in Java


CODE

import java.awt.event.ActionEvent;
     import java.awt.event.ActionListener;
     import javax.swing.JFrame;
     import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    public class MenuBarExample extends JFrame
{
       public MenuBarExample()
{

       setTitle("MenuBarExample");
       setSize(200, 350);


       JMenuBar menuBar = new JMenuBar();

      setJMenuBar(menuBar);


      JMenu fileMenu = new JMenu("File");
      JMenu editMenu = new JMenu("Edit");
      JMenu viewMenu = new JMenu("View");
      menuBar.add(fileMenu);
      menuBar.add(editMenu);
      menuBar.add(viewMenu);


      JMenuItem newAction =   new JMenuItem("New");
      JMenuItem openAction =  new JMenuItem("Open");
      JMenuItem exitAction =    new JMenuItem("Exit");
      JMenuItem cutAction =     new JMenuItem("Cut");
      JMenuItem copyAction =  new  JMenuItem("Copy");
      JMenuItem pasteAction =  new JMenuItem("Paste");
      JMenuItem toolbarsAction= new JMenuItem("toolbarsAction");
      fileMenu.add(newAction);
      fileMenu.add(openAction);
      fileMenu.addSeparator();
      fileMenu.add(exitAction);
      editMenu.add(cutAction);
      editMenu.add(copyAction);
      editMenu.add(pasteAction);
      editMenu.addSeparator();
      viewMenu.add(toolbarsAction);

       newAction.addActionListener(new ActionListener();
 {
      public void actionPerformed(ActionEvent arg0)
 {
      System.out.println("You clicked on the new action");
  }
  }
  };
  }
     public static void main(String[] args)
 {
     MenuBarExample mba = new MenuBarExample();
     mba.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     mba.setVisible(true);
 }
 }
OUTPUT ON COMMAND


C:\saurabh>javac MenuBarExample.java

C:\saurabh>java MenuBarExample



OUTPUT DISPLAY

// PROGRAM TO CALCULATE ADDITION OF 2 NUMBER.


CODE


import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;


    public class AppletSum extends Applet implements ActionListener{
      TextField text1,text2,output;
      Label label1,label2,label3;
      Button button;
      public void init(){
        setLayout(null);
        label1 = new Label("Enter Number1: ");
        label1.setBounds(20,20,100,20);
        add(label1);


        text1 = new TextField(5);
        text1.setBounds(150,20,100,20);
        add(text1);


        label2 = new Label("Enter Number2: ");
        label2.setBounds(20,50,100,20);
        add(label2);


        text2 = new TextField(5);
        text2.setBounds(150,50,100,20);
        add(text2);


        label3 = new Label("Sum of Two Numbers: ");
        label3.setBounds(20,80,130,20);
        add(label3);


        output = new TextField(5);
        output.setBounds(150,80,100,20);
        add(output);


        button = new Button("Sum");
        button.setBounds(150,110,100,20);
        add(button);


        button.addActionListener(this);
        }
        public void actionPerformed(ActionEvent ae){
        int num1=Integer.parseInt(text1.getText());
        int num2=Integer.parseInt(text2.getText());
        int sum=num1+num2;
        output.setText(Integer.toString(sum));
        }
    }



HTML CODE

<HTML>
<BODY>
<APPLET ALIGN="CENTER" CODE="AppletSum.class" width = "700" height = "400"></APPLET>
</BODY>
</HTML>


OUTPUT DISPLAY





Sunday, 17 April 2011

4Videosoft MKV Video Converter 3.3.22 Portable


4Videosoft MKV Video Converter 3.3.22 Portable


4Videosoft MKV Video Converter 3.3.22 Portable

DOWNLOAD

Saturday, 16 April 2011

Anti-Trojan Elite 5.3.9 Multilingual

Thursday, 14 April 2011

Swype


Swype for Unhacked Vivaz & Satio 1.0.16481





DOWNLOAD


 
FOR GENIOUS | Copyright © 2011 Diseñado por: compartidisimo | Con la tecnología de: Blogger