You are confusing objects with reference variables. When you say String s = "ABC";
"ABC" is an immutable String object, and s is a (not immutable) reference to a String. The current value of s is a reference to the "ABC" object. s = s + "DEF";
You now have 3 String objects, "ABC", "DEF", and "ABCDEF", all immutable. The reference variable s has been updated to refer to the "ABCDEF" object.
I dont know if i am wrong. "ABC" is a value stored in s. Is "ABC" also called immutable object. If you can tell what exactly is the difference between immutable object and reference variable with example,it is really useful.Thanks in advance.
"ABC" is NOT a value stored in s. This is where you are going wrong.
"ABC" is a value stored somwhere in the Java VM's heap memory. The "value" stored in s is a reference (you can think of it as a pointer if you like) to the place where "ABC" is stored. The reference value in s can be changed at any time, but the "ABC" value in teh heap cannot be changed.
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...