| VB | Java |
|---|---|
| 'This line is a comment | //this line is a comment |
| /*this is a multi-line comment*/ | |
| lines end with carriage return | lines end with semicolon |
| VB | Java |
|---|---|
| Dim x as integer | int x; |
| Dim x as long | long x; |
| Dim userName as String | String userName = new(String); |
| Dim x as single | float x; |
| Dim x as double | double x; |
| x = 5 | x = 5; x = 5d; x = 5f; x = 5L; |
| VB | Java |
|---|---|
| i = i + 5 | i += 5; |
| i = i -5 | i -= 5; |
| i = i + 1 | i++; |
| i = i - 1 | i--; |
| userName = userName + "-San" | userName += "-San"; |
| VB | Java |
|---|---|
| x = 5 | (x == 5) |
| x <> 5 | (x != 5) |
if i < 5 then ... end if |
if(i < 5){
...
} // end if
|
if i < 5 then ... else ... end if |
if(i < 5){
...
} else {
...
} // end if
|
Dim userName as String if userName = "Wally" then ... end if |
String userName;
if (userName.equals("Wally")){
...
} // end if
|
Dim userName as String if ucase(userName) = "WALLY" then ... end if |
String userName;
if (userName.equalsIgnoreCase("WALLY")){
...
} // end if
|
Select case x
case 1
...
case 2
...
case else
end select
|
switch (x){
case 1:
...
case 2:
...
default:
...
} // end switch
|
| VB | Java |
|---|---|
Do while x < 10 ... Loop |
while(x < 10){
...
} // end while
|
Do ... Loop while x < 10 |
do{
...
} while ( x < 10);
|
for i = 1 to 10 ... next i |
for (i = 0; i < 10; i++){
...
} // end for
|
for i = 10 to 1 step -1 ... next i |
for (i = 10; i > 0; i--); ... } // end for |
| VB | Java |
|---|---|
| form | Frame |
| label | Label |
| command button | Button |
| textbox | TextField |
| multi-line text box | TextArea |
| Hor / Ver Scrollbar | Scrollbar |
| Listbox | List |
| combo box | Choice |
| Check boxes | Checkbox |
| Radio buttons (frame) | Checkbox (CheckboxGroup) |
| VB | Java |
|---|---|
| lblOutput.caption = "hi there" | lblOutput.setText("hi there"); |
| myVar = txtInput.text | myVar = txtInput.getText(); |
| x = scrHowMany.value | x = scrHowMany.getValue(); |
| VB | Java |
|---|---|
| form_load | init (applet) or constructor (class) |
| function doThis(param as Integer) as String | public String doThis(int param){ |
| sub doThis(param as Integer) | public void doThis(int param){ |
sub cmdOk_click() ... end sub sub (other events here) ... end sub |
cmd.addActionListener(this);
public void ActionPerformed(ActionEvent e){
if (e.getActionCommand().equals cmdOK.getText()){
...
} else {
... check other buttons
} // end if
} // end actionPerformed
|