Java's Constructors and Functions...

Status
Not open for further replies.

himalya

Solid State Member
Messages
19
Can you pls guide me through these terms in Java..
1.Implicit & Exlicit call constructors.
2.Pure and Impure Functions.

Is there a diff between call by value and pass by value.
I think that in terms of the taking method it is calling and if we take in terms of giving it is passing...Am I right??

same goes for call by reference and pass by reference..

PLS::I AM NOT ASKING DIFF BETWEEN CALL BY VALUE AND CALL BY REFERENCE same for PASS BY VALUE AND PASS BY REFERENCE.
 
Technically, you only pass by value or reference, not call. The caller doesn't get to choose value or reference, that's decided by the passer. In Java, you don't really get to choose at all. All objects are passed by reference, while primitives are passed by value. (If you want to get really technical -- and most people don't on this issue -- from a compiler writer's perspective, Java is strictly pass by value. Objects actually aren't passed by reference, references to objects are passed by value.)

Pure functions don't modify their arguments or output anything. The result of a pure function call is the return value.

When you call the constructor of a subclass, if you don't explicitly call the base class constructor, the JVM will automatically (implicitly) call the parameterless base class constructor. Obviously, if no parameterless base class constructor exists, you have a problem.
 
Status
Not open for further replies.
Back
Top Bottom