Java初学者:图书管理小工具代码
1.Welcome.java
import java.util.Date;
import java.util.Scanner;
public class Welcome {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args){
// TODO Auto-generated method stub
System.out.println("Welcome to visit software of book management!\n");
System.out.println("Now is "+new Date()+"\n");
Select s=new Select();
s.SelectService();
}
}
2.Select.java
import java.util.Scanner;
public class Select {
ReturnBook rb=new ReturnBook();
InquireBook ib=new InquireBook();
LendBook lb=new LendBook();
ShowAllBooks sab=new ShowAllBooks();
AddBook ab=new AddBook();
ShowLentBooks slb=new ShowLentBooks();
public void SelectService()
{
System.out.println("1.Show all the books\n2.Inquire book\n3.Lend book\n4.Return book\n5.Add book\n" +
"6.Show lent books");
System.out.print("Please select one from services listed above:");
Scanner s=new Scanner(System.in);
int selectNumber=s.nextInt();
if(selectNumber==1)
{
sab.ShowAll();
}
else if(selectNumber==2)
{
ib.Inquire();
}
else if(selectNumber==3)
{
lb.Lend();
}
else if(selectNumber==4)
{
rb.returnBook();
}
else if(selectNumber==5)
{
ab.add();
}
else if(selectNumber==6)
{
slb.ShowLent();
}
else
{
System.out.println("Input error,Please select one from services listed below again.");
Select ss=new Select();
ss.SelectService();
}
}
}
3.AddBook.java
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.
相关文档:
插入式排序运行效率N*(N-1)/4 对于随机数字,这个算法比冒泡快1倍,比选择排序稍微快一点.
如果是基本有序的队列则优势最为明显需要O(N)
代码一样是从冒泡排序继承下来的.
/**
*
* @author leon.lee
*/
public class InsertSort extends BubbleSort {
public InsertSort(int lengthArray){
......
一、利用jdk web服务api实现,这里使用基于 SOAP message 的 Web 服务
1.首先建立一个Web services EndPoint:
Java代码
package Hello;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.xml.ws.Endpoint;
@WebService
public class Hello {
@WebMet ......
声明字段映射
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface FiledRef
{
String fieldName();
}
声明表映射
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface TableRef
{
& ......
1 MySQL存储大容量的二进制文件的格式是blob,其实除了图片还可以存别的
2 要向数据库存储二进制的文件一定要把要存储的数据转换成二进制流
废话就不多说了,大家看看代码很容易明白,先来看一个app程序,当然首先您要在数据库中先建立一个用于保存图片的表和相应的列,数据格式为blob
package ......