_HumanInstance = new HumanInstance(); --建立一个对象 _HumanInstance.go(); --调用对象方法 静态执行,加载类即执行 _HumanInstance是在哪定义的呢?
确切的说:类构造函数。 我们平常所说的构造函数就是 非 static的 构造函数。呵呵~~
<tr> <%set com=server.createobject("adodb.connection") com.open "DBQ="& Server.MapPath("data.mdb") &";Driver={Microsoft Access Driver (*.mdb)}" if request("ok")="ok" then response.write "hello" set rs=com.execute("select*from main where user>=#" & date & "# ORDER BY id DESC") page=request("page") newpage=0 if page="" then page=1 do while newpage<page*101-101 newpage=newpage+1 rs.movenext loop do while not rs.eof i=i+1%> <td width="435" height="26" valign="middle" bgcolor="#F0F0F0"><span class="f14"><a href="<%response.write rs(2)%>" target="_blank"> <%response.write rs(1)%> </a></span><font color="#FF6600"> </font></td>
</tr> <%if i=100 then exit do
rs.movenext loop%> 请问如何实现循环到5条信息的时候换行啊???换行啊
静态初始化详细情况《thinking in java》有讲
注: public class InchesToFeet { private static final int inches=12; protected InchesToFeet() { } public static double convert(double in) { return(in/inches); } static { System.out.println("这是首先执行的静态块!");//可以写多个 例: } static { System.out.println("这是首先执行的静态块第二个!"); } static { System.out.println("这是首先执行的静态块第三个!"); } public static void main(String[] args) { double inch=66; double feet=InchesToFeet.convert(inch); System.out.println(inch+"inch is"+feet+"feet."); } } 简单小例子能明白吗!那个静态块在第一次使用类时执行,可以写多个,这个功能在有些情况下用起来很方面!自己想吧!
public class humans
{
.......... static
{
_HumanInstance = new HumanInstance();
_HumanInstance.go();
}}
_HumanInstance.go(); --调用对象方法
静态执行,加载类即执行 _HumanInstance是在哪定义的呢?
我们平常所说的构造函数就是 非 static的 构造函数。呵呵~~
<%set com=server.createobject("adodb.connection")
com.open "DBQ="& Server.MapPath("data.mdb") &";Driver={Microsoft Access Driver (*.mdb)}"
if request("ok")="ok" then response.write "hello"
set rs=com.execute("select*from main where user>=#" & date & "# ORDER BY id DESC")
page=request("page")
newpage=0
if page="" then page=1
do while newpage<page*101-101
newpage=newpage+1
rs.movenext
loop
do while not rs.eof
i=i+1%>
<td width="435" height="26" valign="middle" bgcolor="#F0F0F0"><span class="f14"><a href="<%response.write rs(2)%>" target="_blank">
<%response.write rs(1)%>
</a></span><font color="#FF6600"> </font></td>
</tr>
<%if i=100 then exit do
rs.movenext
loop%>
请问如何实现循环到5条信息的时候换行啊???换行啊
public class InchesToFeet
{
private static final int inches=12;
protected InchesToFeet()
{
}
public static double convert(double in)
{
return(in/inches);
}
static
{
System.out.println("这是首先执行的静态块!");//可以写多个 例:
}
static
{
System.out.println("这是首先执行的静态块第二个!");
}
static
{
System.out.println("这是首先执行的静态块第三个!");
}
public static void main(String[] args)
{
double inch=66;
double feet=InchesToFeet.convert(inch);
System.out.println(inch+"inch is"+feet+"feet.");
}
}
简单小例子能明白吗!那个静态块在第一次使用类时执行,可以写多个,这个功能在有些情况下用起来很方面!自己想吧!