DelphiÖÐʵÏÖC++/JavaÀàËƾ²Ì¬±äÁ¿µÄ¹¦ÄÜ
ÔÚÍøÉÏ¿´µ½ºÜ¶àÈ˶¼ÔÚΪDelphiÊÇ·ñÖ§³ÖC++/JavaÖеľ²Ì¬±äÁ¿¼°¾²Ì¬·½·¨µÄ¹¦ÄܶøÀ§ÈÅ,ÆäʵÕâÔÚDelphiÖÐÊǺܼòµ¥µÄ.
¾²Ì¬·½·¨¾ÍÊÇʹÓÃClass Function. ¾²Ì¬±äÁ¿ÔòʹÓõ¥Ôª¾Ö²¿±äÁ¿À´ÊµÏÖ. ´úÂëÈçÏÂ:
//=========================================
// StaticVarTestU - ¶¨ÒåÁË¿ÉÒÔ¼ÆÊýµÄÀ࣬ͨ¹ýÀà·½·¨¼´¿É·ÃÎÊ´ËÀàµÄ¶ÔÏóÊý
//=========================================
unit StaticVarTestU;
interface
type
TStaticVarClass = class
public
//constructor
constructor Create();
destructor Destroy; override;
//Àà·½·¨£¬È¡µÃ¶ÔÏóµÄ¼ÆÊý
class function ObjectCount: integer;
protected
private
end;
implementation
Var
LObjCount: integer;
{ TStaticVarClass }
constructor TStaticVarClass.Create;
begin
inc(LObjCount); //ʹÓþֲ¿±äÁ¿
end;
destructor TStaticVarClass.Destroy;
begin
dec(LObjCount); //ʹÓþֲ¿±äÁ¿
inherited;
end;
class function TStaticVarClass.ObjectCount: integer;
begin
Result := LObjCount; //·µ»Ø¾Ö²¿±äÁ¿
end;
initialization
LObjCount := 0; //³õʼ»¯
finalization
LObjCount := 0;
end.
//=========================================
// StaticTest - ²âÊÔ´úÂë,´´½¨10¸ö¶ÔÏó,²¢·ÃÎÊÆä¼ÆÊý,ÔÙFreeµô.
//=========================================
program StaticTest;
{$APPTYPE CONSOLE}
uses
SysUtils,
Classes,
StaticVarTestU in StaticVarTestU.pas;
procedure printObjCount;
begin
WriteLn(Format(The Object Count now is %d, [TStaticVarClass.ObjectCount]));
end;
var
i: integer;
mObjList: TList;
begin
{ TODO -oUser -cConsole Main : Insert code here }
mObjList := TList.Create;
printObjCount;
for i := 0 to 10 do
begin
mObjList.Add(TStaticVarClass.Create());
printObjCount;
end;
for i := 0 to mObjList.Count -1 do
begin
TStaticVarClass(mObjList.Items[i]).Free;
printObjCount;
end;
mObjList.Free;
readln;
end.
Ïà¹ØÎĵµ£º
LombokÊÇÒ»¸ö¿ªÔ´ÏîÄ¿£¬¿ÉÒÔÓÃÀ´Ïû³ýJava´úÂëµÄÈß³¤
Ïêϸ½éÉܲο´http://www.ibm.com/developerworks/opensource/library/os-lombok/index.html
ÏÂÃæ½éÉÜLombokÈçºÎÏû³ýJava´úÂëµÄÈß³¤¡£
1. Ê×ÏÈÈ¥http://projectlombok.org/. ÏÂÔØlombok.jar °ü
2. & ......
ת×Ô http://www.bjtarena.com/html/2010/4/1058.htm
ºÜ¶àÅóÓÑÔÚÉîÈëµÄ½Ó´¥JavaÓïÑÔºó¾Í»á·¢ÏÖÕâÑùÁ½¸ö´Ê£º·´Éä(Reflection)ºÍÄÚÊ¡(Introspector)£¬¾³£¸ã²»Çå³þÕâµ½µ×ÊÇÔõô»ØÊ£¬ÔÚʲô³¡ºÏÏÂÓ¦ÓÃÒÔ¼°ÈçºÎʹÓã¿
¡¡¡¡·´Éä
¡¡¡¡Ïà¶Ô¶øÑÔ£¬·´Éä±ÈÄÚÊ¡¸üÈÝÒ×Àí½âÒ»µã¡£ÓÃÒ»¾ä±È½Ï°×µÄ»°À´¸ÅÀ¨£¬·´Éä¾ÍÊÇÈÃÄã¿ÉÒÔͨ¹ýÃû³ÆÀ ......
import java.util.*;
public class stack
{
private List list=new ArrayList();
private int index=0;
public void push(Object obj)
& ......
===================================TimerTask=======================================
import java.util.TimerTask;
import java.util.Calendar;
public class MyTask extends TimerTask
{
private ......
Ò»£®POI¼ò½é
Jakarta POI ÊÇapacheµÄ×ÓÏîÄ¿£¬Ä¿±êÊÇ´¦Àíole2¶ÔÏó¡£ËüÌṩÁËÒ»×é²Ù×ÝWindowsÎĵµµÄJava API
Ä¿Ç°±È½Ï³ÉÊìµÄÊÇHSSF½Ó¿Ú£¬´¦ÀíMS Excel£¨97-2002£©¶ÔÏó¡£Ëü²»ÏóÎÒÃǽö½öÊÇÓÃcsvÉú³ÉµÄûÓиñʽµÄ¿ÉÒÔÓÉExcelת»»µÄ¶«Î÷£¬¶øÊÇÕæÕýµÄExcel¶ÔÏó£¬Äã¿ÉÒÔ¿ØÖÆһЩÊôÐÔÈçsheet,cellµÈµÈ¡£
¶þ£®HSSF¸Å¿ö
......