VB定义函数的方式:例如Public Function GetCustomerID() As String
GetCustomerID = strCustomerID
End Function
Java中在定义函数(方法)的时候 必须定义在类中Public class Class1{
public String GetCustomerID(){
//GetCustomerID = strCustomerID
return "";
}
}
对比代码:可以发现vb的变量也好,函数也好 都不区分大小写
Java严格区分大小写
VB 定义函数不是使用 { }
而使用 Function end Function表示
VB的IF语句
在条件语句里,我们先来学习“If……Then……”语句。
语法:
If Then
End If
如果希望条件不满足时执行另一语句,可以以增加一个else语句:
If Then
else
End If
而Java的IF语句不一样
If (条件){
}else{
}
------------------------------------
VB和java的区别实在太多了,从语法上 都能找到 N多的区别 完全是两个不同的语法