二、变量声明:
VB.Net:VB.net: Dim 变量名 as 类型名 [= 初值] [,变量名 as 类型名 [= 初值] [,…]]
C#:类型名 变量名 [= 初值] [,变量名 [= 初值] [,…]]];
Java:类型名 变量名 [= 初值] [,…]]];
示例:
VB.Net:Dim nValue as Integer
C#: int nValue;
Java:int nValue;
三、常量声明:
VB.net: Const 常量名 as 类型名 = 值 [,常量名 as 类型名 = 值 [,…]]
C#:const 类型名 常量名 = 值 [,常量名 = 值 [,…]]];
Java: final 类型名 常量名 = 值 [,…]]];
示例:
VB.net: Const PI as Single = 3.1415926
C#:const float PI = 3.1415926;
Java:final float PI= 3.1415926;
四、面向对象的声明:
示例:
VB.Net
Namespace EVACN ‘名域
{ Public Class Factory
Inherits Building’父类
Implements IWorker’所实现的接口
{
Public Sub New()’构造函数
‘…..
End Sub
Public Sub Finalize()’析构函数
‘…..
End Sub
Public Overrides Sub Work Implements IWorker.Work ‘所实现的接口函数
‘…..
End Sub
Public Function GetName As String ‘成员函数
Return “”
End Function
}
}
C#
namespace EVACN
{
public class Factory:Building,IWorker
{
public string GetName()
{
return “heh”;
}
}
}
Java:
package EVACN ;
Interface Iworker {
void Work();
}
class Factory extends Building Implements IWork{
public Factory()
}
public finalize(){
’....
}
public void Work()
{
’....
}
public String GetName()
{
return “heh”;
}