Why can’t we make arrays in Java like this:
int marks[5];
And assign values after this declaration?
Anyone please explain the terminology or difference.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is because there are no stack arrays in Java. Here is Java equivalent:
It looks a lot like allocating dynamically-sized arrays in C++. Of course you don’t have to worry about calling a
delete[], because it’s garbage collected.