Hi
Im am bigginer in java and i want to know :If a,b are variables of integer type and S1,S2 are variables of Student,what does mean a=b, si=s2. Is any change in way how the value pass in these examples??

I am waiting for a response
best regards Eda

,what does mean a=b, si=s2

The value of the variable to the right of the = is copied to the variable to the left of the =. Now both variables have the same value.

but is there any diference between te way that pass a primitive and reference variable?

The assignment statements work the same way for primitives and objects.

What do you mean by pass? Can you give an example?

a and b are int variables. Their values are integers.
a=b means that the integer value of b is copied into a, so they now both have the same integer value.
S1 and S2 are reference variables. Their values are references to Objects of type Student.
S1=S2 means that the value of S2 is copied into S1, so they now both refer to the same Student object.

a=b and si=s2....
a=b mean if b hold any value such as b=10,then value of b is assign to a.it mean a also holds the value 10.
si=s2 mean si take reference of s2 to hold the value which is hold by s2....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.