Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts
Friday, 5 July 2013 0 comments

Java Database Connection With SQL

Java Database Connection

Here is the Java Programming Program of Database Connection with SQL of Miss Aisha Khan.

Note : This is Program not Presentation or PDF Kindly Understand the code and Work. Can Ask Anytime for help.


JavaForm: Make 2 textboxes and 3 button for Insert,Update and Delete

Insert Button
 
 try{
      
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection conn=DriverManager.getConnection("jdbc:odbc:s1", "sa", "aptech");
       Statement s = conn.createStatement();
        int id=Integer.parseInt(Id.getText());
        String name = Name.getText();
        s.execute("insert into student values('"+id+"','"+name+"')");
        System.out.println("Recond Inserted");
    }
    catch(Exception e){
        System.out.println(e);
    }


Update Button:
 
try{
       
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection conn=DriverManager.getConnection("jdbc:odbc:s1", "sa", "aptech");
       Statement s = conn.createStatement();
        int id=Integer.parseInt(Id.getText());
        String name = Name.getText();
        s.execute("update student set std_name='"+name+"' where std_id='"+id+"'");
        System.out.println("Row Updated");
    }
    catch(Exception e){
        System.out.println(e);
    }

 
Delete Button:

try{
      
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection conn=DriverManager.getConnection("jdbc:odbc:s1", "sa", "aptech");
       Statement s = conn.createStatement();
        int id=Integer.parseInt(Id.getText());
        String name = Name.getText();
        s.execute("delete from student where std_id='"+id+"'");
        System.out.println("Row Deleted");
    }
    catch(Exception e){
        System.out.println(e);
    }
Thursday, 4 July 2013 0 comments

Java Synchronized Thread

Java Synchronized Thread

Here is the Java Programming Program of Synchronized Threads of Miss Aisha Khan.

Note : This is Program not Presentation or PDF Kindly Understand the code and Work. Can Ask Anytime for help.


CallMe Class : 
 
package sync_t;

public class CallMe implements Runnable{
   String name;
   Thread th;
   sync_thread t;
 
   public CallMe(String n, sync_thread s)
   {
       name=n;
       t=s;
       th = new Thread(this);
       th.start();
   }
 
 
   public void run()
   {
   t.c(name);
   }
}

sync_thread Class();
 
package sync_t;

public class sync_thread {
synchronized  public void c(String m){
        System.out.println("{"+m);
        try
        {
           Thread.sleep(1000);
        }
        catch(InterruptedException ex)
        {
           
        }
        System.out.println("}");
    }
}


Main Class();




package sync_t;


public class Sync_t {

   
    public static void main(String[] args) {

        sync_thread st = new sync_thread();
       
        CallMe cl = new CallMe("Apt", st);
        CallMe cl2=new CallMe("Owais",st);
       
    }
}
0 comments

Java Getter and Setter Work

Java Getter and Setter Work

Here is the Java Programming Program of Getter and Setter from Miss Aisha Khan.

Note : This is Program not Presentation or PDF Kindly Understand the code and Work. Can Ask Anytime for help.


Student Class :
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gettersetter;

/**
 *
 * @author asp
 */
public class Student {
    int id,age;
    String name;
    public int getid(){
        return id;
    }
    public String getname(){
        return name;
    }
    public int getage(){
        return age;
    }
    public void setid(int i){
        id=i;
    }
    public void setname(String n){
        name=n;
    }
    public void setage(int a){
        age=a;
   }
 
}

Main Class();
 

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gettersetter;

/**
 *
 * @author asp
 */
public class GetterSetter {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Student std=new Student();
        std.setid(45);
        std.setname("Owais");
        std.setage(20);
        System.out.println(std.getid());
        System.out.println(std.getname());
        System.out.println(std.getage());
    }
}
 
Tuesday, 11 June 2013 0 comments

Java Inheritance, Interface and MethodOverloading Special PDF

Java Inheritance, Interface and MethodOverloading Special PDF

Here is the Java Programming PDF from Miss Aisha Khan.

Note : This is Password Protected because of importance this is for only APTECH friends.

Click Here to Download
Saturday, 18 May 2013 0 comments

Java Array Method OOP and Inheritance Notepads


Java Array Method OOP and Inheritance Notepads

Here is the Java Programming Notepad from Miss Aisha Khan. 

Click Here to Download
Click Here to Download
Click Here to Download
Click Here to Download (Array Method)
Click Here to Download (Array)
Click Here to Download (2d Array)
Saturday, 4 May 2013 0 comments

Java third Slide


Java third Slide

Here is the Third Java Programming slide of Miss Aisha Khan. 

Click Here to Download
0 comments

Java Second Slide(Loops, Conditions)


Java Second Slide(Loops, Conditions)

Here is the Java Programming slide of Miss Aisha Khan. 

Click Here to Download
0 comments

Java First Slide


Java First Slide

Here is the Java Programming slide of Miss Aisha Khan. 

Click Here to Download
 
;