flex通过blazeds与java实现增删改查 整个实现流程
1,建一个userdb库,再建userinfo表,字段:id(int),username(varchar),password(varchar)。
2,DBConnection.java
package com.datainfo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBConnection {
public static Connection getConnection() throws ClassNotFoundException,
SQLException {
Connection conn = null;
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/userdb"; //不同数据库不同JDBC
String username = "sa";
String password = "sasa";
Class.forName(driver);
conn = DriverManager.getConnection(url, username, password);
return conn;
}
}
3,User.java
package com.datainfo;
public class User {
private int id;
private String username;
private String password;
public User() {
}
/**
* @return the id
*/
public int getId() {
相关文档:
List的用法
List包括List接口以及List接口的所有实现类。因为List接口实现了Collection接口,所以List接口拥有Collection接口提供的所有常用方法,又因为List是列表类型,所以List接口还提供了一些适合于自身的常用方法,如表1所示。
表1 List接口定义的常用方法及功能
从表1可以看出,List接口提供的适合于自身的 ......
如何交换两个变量的值:
C语言中的传值代码如下:
int change(int x,int y)
{
int temp=x;
x=y;
y=temp;
}
C语言中的传址代码如下:
int change(int *p,int *q)
{
int temp=*p;
*p=*q;
*q=temp;
}
使用C++中的引用类型代码如下:
int change(int &x,int &y)
{
int temp=x;
x=y;
y=temp;
}
JAV ......
自从上次写了二分法查找代码后突然打算好好学习一下数据结构.买了一本数据结构与算法......
import java.util.Random;
/**
*
* @author leon.lee
*/
public class BubbleSort {
private int[] arrayData;
public void printArrayList(){
if (arrayData!=null){
for(int i:a ......
选择排序就是从数据里面找到最小的放到最左边,每次比较所有数据后交换一次.
我从之前的冒泡排序类继承下来的.
package array;
/**
*
* @author leon.lee
*/
public class SelectionSort extends BubbleSort{
public SelectionSort(int arrayLength){
super(arrayLength);
}
@Override
......