Note that conversions marked with a * can also raise Type Mismatch Error.
VB/Java |
boolean |
byte |
short |
int |
Boolean |
natural |
vb ? 1 : 0 |
vb ? 1 : 0 |
vb ? 1 : 0 |
Byte(0..255) |
vb != 0 |
new Integer(vb).byteValue() |
new Integer(vb).shortValue() |
new Integer(vb).intValue() |
Integer(16 bit) |
vb != 0 |
new Short(vb).byteValue() |
natural |
new Short(vb).intValue() |
Long(32 bit) |
vb != 0 |
new Integer(vb).byteValue() |
new Integer(vb).shortValue() |
natural |
Single |
vb != 0.0F |
new Float(vb).byteValue() |
new Float(vb).shortValue() |
new Float(vb).intValue() |
Double |
vb != 0.0 |
new Double(vb).byteValue() |
new Double(vb).shortValue() |
new Double(vb).intValue() |
Currency(64 bit) |
vb != 0 |
new Long(vb).byteValue() |
new Long(vb).shortValue() |
new Long(vb).intValue() |
String |
new Boolean(vb).booleanValue() |
new Long(vb).byteValue()* |
new Long(vb).shortValue()* |
new Long(vb).intValue()* |
Date |
Type Mismatch Error |
Type Mismatch Error |
Type Mismatch Error |
Type Mismatch Error |
Object |
Type Mismatch Error |
Type Mismatch Error |
Type Mismatch Error |
Type Mismatch Error |
Variant |
As above depending on content |
VB/Java |
long |
char |
float |
double |
Boolean |
vb ? 1 : 0 |
vb ? (char)1 : (char)0 |
vb ? 1.0F : 0.0F |
vb ? 1.0 : 0.0 |
Byte(0..255) |
new Integer(vb).longValue() |
new Integer(vb).byteValue() |
new Integer(vb).shortValue() |
new Integer(vb).intValue() |
Integer(16 bit) |
new Short(vb).longValue() |
new Short(vb).byteValue() |
new Short(vb).shortValue() |
new Short(vb).intValue() |
Long(32 bit) |
new Integer(vb).longValue() |
new Integer(vb).byteValue() |
new Integer(vb).shortValue() |
new Integer(vb).intValue() |
Single |
new Float(vb).longValue() |
new Float(vb).byteValue() |
new Float(vb).shortValue() |
new Float(vb).intValue() |
Double |
new Double(vb).longValue() |
new Double(vb).byteValue() |
new Double(vb).shortValue() |
new Double(vb).intValue() |
Currency(64 bit) |
new Long(vb).longValue() |
new Long(vb).byteValue() |
new Long(vb).shortValue() |
new Long(vb).intValue() |
String |
new Long(vb).longValue() |
new Long(vb).byteValue() |
new Long(vb).shortValue() |
new Long(vb).intValue() |
Date |
Type Mismatch Error |
Type Mismatch Error |
Type Mismatch Error |
Type Mismatch Error |
Object |
Error |
Error |
Error |
Error |
Variant |
As above depending on content |
VB/Java |
String |
Date |
Object |
|
Boolean |
natural |
vb ? 1 : 0 |
vb ? 1 : 0 |
vb ? 1 : 0 |
Byte(0..255) |
vb != 0 |
new Integer(vb).byteValue() |
new Integer(vb).shortValue() |
new Integer(vb).intValue() |
Integer(16 bit) |
vb != 0 |
new Short(vb).byteValue() |
new Short(vb).shortValue() |
new Short(vb).intValue() |
Long(32 bit) |
vb != 0 |
new Integer(vb).byteValue() |
new Integer(vb).shortValue() |
new Integer(vb).intValue() |
Single |
vb != 0 |
new Float(vb).byteValue() |
new Float(vb).shortValue() |
new Float(vb).intValue() |
Double |
vb != 0 |
new Double(vb).byteValue() |
new Double(vb).shortValue() |
new Double(vb).intValue() |
Currency |
vb != 0 |
new Long(vb).byteValue() |
new Long(vb).shortValue() |
new Long(vb).intValue() |
String |
new Boolean(vb).booleanValue() |
new Long(vb).byteValue() |
new Long(vb).shortValue() |
new Long(vb).intValue() |
Date |
Error |
Error |
Error |
Error |
Object |
Error |
Error |
Error |
Error |
Variant |
As above depending on content |
Java |
VB |
Notes and converson used. |
void byteMethod(byte p1) |
javaObject.byteMethod(123) |
integer number ByVal. |
javaObject.byteMethod(12.3) |
float number ByVal. |
|
javaObject.byteMethod(false) |
boolean ByVal. |
|
javaObject.byteMethod("101") |
String ByVal. |
|
Dim byteParam as Byte |
Byte ByRef. |
|
Dim booleanParam as Boolean |
Boolean ByRef. |
|
Dim integerParam as Integer |
Integer ByRef. |
|
Dim longParam as Long |
Long ByRef. |
|
Dim singleParam as Single |
Single ByRef. |
|
Dim doubleParam as Double |
Double ByRef. |
|
Dim currencyParam as Currency |
Currency ByRef. |
|
Dim dateParam as Date |
Date ByRef. |
|
Dim stringParam as String |
String ByRef. |