public abstract class DrinkProduce {
//第一步:加原料
public abstract void addOrginal();
//第二步:加水
public void addWater(){
System.out.println("第二步:加水");
}
//第三步:烧水
public void boilWater(){
System.out.println("第三步:烧水");
}
//第四步:加工
public abstract void makeDrink();
//第五步:混合
public void getDrink(){
this.addOrginal();
this.addWater();
this.boilWater();
this.makeDrink();
System.out.println("第五步:混合,包装,完成操作");
}
}
MikeProduce
public class MilkProduce extends DrinkProduce{
@Override
public void addOrginal() {
System.out.println("加牛奶");
}
@Override
public void makeDrink() {
System.out.println("萃取,提纯,杀菌");
}
}
CoffeeProduce
public class CoffeeProduce extends DrinkProduce{
@Override
public void addOrginal() {
System.out.println("加咖啡豆");
}
@Override
public void makeDrink() {
System.out.println("将煮好的咖啡,打上奶泡,拉花");
}
}
Client 测试类:
public class Client {
public static void main(String[] args) {
DrinkProduce milkProduce = new MilkProduce();
DrinkProduce coffeeProduce = new CoffeeProduce();
milkProduce.getDrink();
coffeeProduce.getDrink();
}
}
public abstract class JdbcTemplate {
private DataSource dataSource;
public JdbcTemplate(DataSource dataSource){
this.dataSource = dataSource;
}
private Connection getConnection() throws Exception{
return this.getConnection();
}
private PreparedStatement createPreparedStatement(Connection connection,String sql) throws Exception{
return connection.prepareStatement(sql);
}
private ResultSet executeQuery(PreparedStatement pstmt,Object[] values) throws Exception{
for (int i = 0;i parseResultSet(ResultSet rs,RowMapper rowMapper) throws Exception{
List
模拟一个MemberDao
public class MemberDao extends JdbcTemplate{
//private JdbcTemplate jdbcTemplate = new JdbcTemplate(null);
public MemberDao(DataSource dataSource){
super(dataSource);
}
public List query(){
String sql = "select * from t_member"; this.processResultSet(rs,rowNum);
/*return jdbcTemplate.executeQuery(sql,new RowMapper(){
@Override
public Member mapRow(ResultSet rs, int rowNum) throws Exception {
Member member = new Member();
member.setUsername(rs.getString("username"));
member.setPassword(rs.getString("password"));
member.setAddr(rs.getString("addr"));
member.setAge(rs.getInt("age"));
member.setNicename(rs.getString("nickname"));
return member;
}
},null);*/
}
@Override
public Object processResultSet(ResultSet rs, int rowNum) throws SQLException {
Member member = new Member();
member.setUsername(rs.getString("username"));
member.setPassword(rs.getString("password"));
member.setAddr(rs.getString("addr"));
member.setAge(rs.getInt("age"));
member.setNicename(rs.getString("nickname"));
return member;
}
}
最近受我的朋友委托用js+HTML做一个像手册一样的程序,里面要有可展开的大纲,模糊查找等功能。我这个人说实在的懒,本来是不愿意的,但想起了父亲以前教我要给朋友搞好关系,再加上这也可以巩固自己的js技术,于是就开始开发这个程序,没想到却出了点小问题,我做的查找只能绝对查找。具体的js代码如下:
function search(){
var arr=new Array("my
实例:
CREATE OR REPLACE PROCEDURE test_Exception
(
ParameterA IN varchar2,
ParameterB IN varchar2,
ErrorCode OUT varchar2 --返回值,错误编码
)
AS
/*以下是一些变量的定义*/
V1 NUMBER;
V2 nvarc
Spark Streaming简介
NetworkWordCount代码
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
代码示例:
# include <stdio.h>
//冒泡排序
void sort(int * a, int len)
{
int i, j, t;
for (i=0; i<len-1; i++)
{
for (j=0; j<len-1-i; j++)
{
if (a[j] > a[j+1]) // >表示升序
nginx日志分割 for linux 默认情况下,nginx是不分割访问日志的,久而久之,网站的日志文件将会越来越大,占用空间不说,如果有问题要查看网站的日志的话,庞大的文件也将很难打开,于是便有了下面的脚本 使用方法,先将以下脚本保存为 cutlog.sh,放在/root 目录下,然后给予此脚本执行的权限
复制代码代码如下:
chmo
http://bukhantsov.org/2011/08/how-to-determine-businessobjects-service-pack-and-fix-pack/
The table below is helpful. Reference
BOE XI 3.x
12.0.0.
y BOE XI 3.0 12.0.
x.
y BO
大家都知道吧,这很坑,尤其是用惯了mysql里的自增字段设置,结果oracle里面没有的。oh,no 我用的是12c版本的,它有一个新特性,可以这样设置自增序列,在创建表是,把id设置为自增序列
create table t
(
id number generated by default as identity (start with 1 increment b