Write code to performe each of the following operations 1 Cr
Write code to performe each of the following operations.
1. Creat a new instance of the Random class which seeds the random number generator 101101101. Name the reference myNumberGenerator.
2. Creat two Character objects that contain the same value, one using the object creation sytle, and one using the primitive creation style.
3. Creat two Double reference objects which contain the same numerical value, but in different object instances.
4. Creat two Double reference objects which contain the same numerical value, and point to the same object instance.
5. Assuming a reference variable named i1 of type integer exists, declare a primitive variable i2 which contains the same value, explicitly using the built-in wrapper class value conversion method.
6. Convert a String value \"1000\" to a primitive int type named oneThousand.
7. Write an expression which returns true if the String lengthCheck has a length of 10.
True or False:
1. Given the follwoing code: Integer a = 100; Integer b =a, a = 200; The reference varible b contains the vlaue 200.
2. The expression (new Integer(3) == new Integer(3)) returns false.
3. It is possible to create an object reference which does not point to an instance of an object.
4. The object reference declartion: String s; will assign the value null to s.
5. It is not necessary to de-allocate object memeory in java.
Solution
2) Charcter object creation: Character is a predefined class.
Object Style: Character objectStyle = new Character();
Primitive Style Character primStyle = \'a\';
