You need to sign in to do that
Don't have an account?
Srinu@dreams
Integer s2 = new Integer(); is it possible to create like this in apex
String a = 'Java';
String b = new String(a);
String c = 'Java';
System.Debug('***'+a);
System.Debug('***'+b);
Is it possible to create like this in apex,? In java it is possible.
Hi
String a = 'Java';
String b = new String(a);
String c = 'Java';
the second line will give an error
Type cannot be constructed:
you can do like this directly
String b=a;
in Apex
-------------
In Apex, all primitive data type arguments, such as Integer or String, are passed into methods by value. This means that any changes to the arguments exist only within the scope of the method. When the method returns, the changes to the arguments are lost.
Non-primitive data type arguments, such as sObjects, are also passed into methods by value. This means that when the method returns, the passed-in argument still references the same object as before the method call and can't be changed to point to another object. However, the values of the object's fields can be changed in the method.
in jave
-----------
String Methods: As in Java, Strings can be manipulated with a number of standard methods. See String Methods for information.