Var
<VariableName>: <ClassName>;
Inside
VariableName
is the name of the objectClassName
is the name of the class, it is important to declare the correct name of the class, replace the sign. By the _ sign when accessing the package class
Example
Var
m: java_lang_Math;
list: java_util_ArrayList;
c: android_graphics_Color;
begin
...
end.
We will use the new
function to initialize an Object
NOTE: it is not possible to initialize a final class
.
Syntax:
New(object);
Or
New(object, list_parameters);
Param list_parameters
is the list of parameters to initialize object
Example
Var
List: java_util_ArrayList;
Begin
New(list);
End.
Or
Var
mSocket: java_net_Socket;
ipAddress: string;
port: integer;
Begin
ipAddress: = '192.168.1.1';
port: = 80;
{Socket mSocket = new Socket(ipAddress, port)}
New(mSocket, ipAddress, port);
End
Very simple, it's like java
language
For example, we need to call the isConnected
method of the Socket
class
Var
mSocket: java_net_Socket;
ipAddress: string;
port: integer;
Begin
Ipaddress: = '192.168.1.1';
port: = 80;
New(mSocket, ipAddress, port);
Writeln(mSocket.isConnected()); //<==
End
Currently the app is not supported