Link to home
Start Free TrialLog in
Avatar of edwbear1976a
edwbear1976a

asked on

Why the new Operator on Java???

Hi
I’m new on Java

It’s about the operator “new” I know well that every time you want to create an instance or object you have to use the operator new. I also have read about C++ lenguaje before and  the “new” operator is for managing   dinamic memory (Case A) but I also have seen that way to create an object (Case B)

Case A:
ClassName x=new ClassName(ini param) ;where x is a pointer (default value is null) and recieve the memory adress;
Case B
 I can do that as well
ClassName y=ClassName (ini param);


So these are my questions:

1.Looking at the Second Case the y is a pointer too? What is the y?
2.On  Java  you only use the “new” operator (Case A) instead the Case B .. Why??



 
SOLUTION
Avatar of petmagdy
petmagdy
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial