JAVAʵÏÖ¾ØÕó»ù±¾²Ù×÷
niMatrix.java
package com.nileader.matrix;
/*
* Copyright (C) 2009 nileader
* when copyed ,please marked from http://nileader.jimdo.com
*/
class niMatrix {
private double prop[][]; // ÓöþάÊý×é´ú±íÕâ¸ö¾ØÕó
private int rows; //¾ØÕóµÄÐÐÊý
private int cols; //¾ØÕóµÄÁÐÊý
/*
* setter and getter
*/
public double[][] getProp() {
return prop;
}
public void setProp(double[][] prop) {
this.prop = prop;
}
public int getRows() {
return rows;
}
public int getCols() {
return cols;
}
public void setRows(int rows) {
this.rows = rows;
}
public void setCols(int cols) {
this.cols = cols;
}
/*
* ¹¹Ôì·½·¨
*/
public niMatrix(int rows,int cols)
{
this.setRows(rows);
this.setCols(cols);
}
// execute method
/*
* Êä³ö¾ØÕóµÄÊýÖµ
*/
public void outputVal()
{
for(int i=0 ; i<this.getRows() ; i++)
{
for(int j=0 ; j < this.getCols() ; j++)
{
System.out.print(this.getProp()[i][j]+" ");
}
System.out.println("");
}
}
/*
* desc ¼Ó¼õ·¨²Ù×÷
*@pram op (add/sub/mul)
*/
public void operate(String op,niMatrix NM)
{
//ÅжÏÊý¾ÝÓÐЧÐÔ
if(this.getRows() != NM.getRows() || this.getCols() != NM.getCols() )
{
System.out.println("ÎÞ·¨¼ÆËã");
System.out.println("×¢Ò⣬¾ØÕó¼Ó¼õ·¨±ØÐëÐÐÁÐÒ»Ñù£¬ÇëÔÙÊäÈëÒ»¸ö"+rows+"ÐÐ"+cols+"ÁеľØÕó");
System.exit(0);
}
//Ö´Ðмӷ¨²Ù×÷
if( "add".equalsIgnoreCase( op ) )
{
double tmp[][] = new double[this.getRows()][this.getCols()]; //ÔÝʱ±£´æ½á¹û
for(int i =0 ; i < this.getRows(); i ++)
for(int j = 0; j < this.getCols() ; j++)
{
tmp[i][j] = this.getProp()[i][j] + NM.getProp()[i][j];
}
this.setProp(tmp); //·ÅÈë×îÖÕ½á¹û
}
//Ö´Ðмõ·¨²Ù×÷
if( "sub".equalsIgnoreCase( op ) )
{
double tmp[
Ïà¹ØÎĵµ£º
¶ÔÓÚѧϰstaticÎÒÃÇÏÈÀ´¿´Á½¸öÀý×Ó£º
//Example 1 Tst.java£¬no main() method
package com.blogchina.qb2049;
public class Tst
{
static { System.out.println("111111"); }
}
ÔËÐнá¹ûΪ: 111111
Exception in thread "main" java.lang.NoSuchMethodError: main
ͬÑùµÄµÀÀí¿´µÚ¶þ ......
תÌû´¦£ºhttp://dong-java.javaeye.com/blog/375150
1¡£ÍƼöʹÓÃOralce±È½ÏеÄ10.2.0.3 JDBC Drivers¡£Õâ¸ö°æ±¾¶Ô±È9.2µÄ×î´óµÄºÃ´¦ÊÇDriverManager.setLoginTimeoutº¯ÊýÊÇÆð×÷Óõġ£ÉèÖÃÁËÕâ¸ö²ÎÊý£¬ÔÚ¶ñÁÓµÄÍøÂç»·¾³ÖоͲ»»áÓÐÁ¬½ÓÊý¾Ý¿âµÄº¯Êý³¤Ê±¼ä²»·µ»ØµÄÇé¿ö¡£
2¡£JDBC Developer!ˉs Guide and Refer ......
¼òµ¥µÄ˵µ¥Àý¾ÍÊÇ Ö»ÄÜÓÐÒ»¸öʵÀý£¬ËùÒԵط½Óõ½µÄʵÀý¶¼ÊÇͬһ¸ö¡£
¾ÍºÃÏñ¼ÒÈ˳Է¹£¬×À×ÓÊǵ¥ÀýµÄ£¬´ó¼ÒÓõÄÊÇͬһ¸ö¡£¶øÍëÊǶàÀýµÄ£¬Ã¿È˶¼ÓÐ×Ô¼¸µÄ¡£ ÏÂÃæÊǾßÌåµÄÀý×Ó£º
Javaģʽ֮µ¥Àýģʽ£º
µ¥Àýģʽȷ±£Ò»¸öÀàÖ»ÓÐÒ»¸öʵÀý£¬×ÔÐÐÌṩÕâ¸öʵÀý²¢ÏòÕû¸öÏµÍ ......
package org.bupt.test;
import java.util.ArrayList;
class MyResource {
ArrayList<Integer> arrList= new ArrayList<Integer>();
public MyResource(ArrayList<Integer> arrList) {
this.arrList = arrList;
&nbs ......