Is array an object ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is array an object ?

19th Dec 2018, 6:27 PM
Rahul Kumar
Rahul Kumar - avatar
17 Answers
+ 9
Mohit Sharma Include relevant TAGS!! An array, in the context of Java, is a dynamically-created object that serves as a container to hold constant number of values of the same type.
19th Dec 2018, 7:03 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 8
Mohit Sharma • In Java, no variable can ever hold an object. • A variable can only hold a reference to an object. There is a special portion of memory called 》the heap《 where objects live. Instead of holding an object itself, a variable holds the information necessary to find the object in memory. This information is called a reference or pointer to the object. In effect, a reference to an object is the address of the memory location where the object is stored. When you use a variable of object type, the computer uses the reference in the variable to find the actual object.
19th Dec 2018, 7:16 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 8
Danijel Ivanović your suggestion to use advanced search inspired me to add a Custom Search bar to my site preset to only provide results from Sololearn. I hope the community finds this helpful! https://www.freecodeexamples.com/2018/12/sololearn-advanced-search.html?m=1
19th Dec 2018, 8:10 PM
bobbie
bobbie - avatar
+ 8
bobbie Credit to John Wells & Tashi N, that I started using advanced search! 🍻
19th Dec 2018, 8:19 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 7
Hello, 😊 Can you specifying your question correctly! Use the search bar! https://www.sololearn.com/post/10362/?ref=app Please, read our guidelines: https://www.sololearn.com/discuss/1316935/?ref=app An useful code for any new user here!;) https://code.sololearn.com/WvG0MJq2dQ6y/
19th Dec 2018, 6:57 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 7
In fact most of the collection types in Java which are the part of java.util package use arrays internally in their functioning. Since Arrays are objects, they are created during runtime. The array length is fixed.
19th Dec 2018, 7:09 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 7
Mohit Sharma Before asking a question on the Q/A, try to search :  • Google Advenced Search : Set domain to 》sololearn.com《 for  search only on the SoloLearn https://www.google.com/advanced_search   • Eclipse Wiki : "Before asking a question on the forums" https://wiki.eclipse.org/Before_asking_a_question_on_the_forums https://code.sololearn.com/W26q4WtwSP8W/?ref=app
19th Dec 2018, 7:20 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 7
What is the difference between public, protected, package-private and private in Java? https://stackoverflow.com/questions/215497/what-is-the-difference-between-public-protected-package-private-and-private-in Controlling Access to Members of a Class https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
19th Dec 2018, 7:43 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 7
bobbie 😊👍Great! 😄💪👏👏👏👌🍻
19th Dec 2018, 8:12 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 6
Mohit Sharma 👍😉 Have a nice Coding! ;)😊
19th Dec 2018, 7:33 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 4
Here is an excellent explanation for this question: https://www.geeksforgeeks.org/array-primitive-type-object-java/
19th Dec 2018, 7:33 PM
David Carroll
David Carroll - avatar
+ 3
David Carroll so much thank u sir
19th Dec 2018, 7:35 PM
Rahul Kumar
Rahul Kumar - avatar
+ 3
Mohit Sharma The protected members will remain protected and accessible by all sub classes in the inheritance hierarchy. A sub class is able to explicitly increase the visibility of a protected member by overriding the member with a public accessor. NOTE: The visibility of a member can only be increased, not decreased. So... a protected member would not be able to be overridden as private and, therefore, hidden from any of its child classes.
19th Dec 2018, 7:58 PM
David Carroll
David Carroll - avatar
+ 2
Is array an object in Java ? Because an array in Java is created using keyword "new" which is also used to create objects of class.. That's I am confused...
19th Dec 2018, 7:01 PM
Rahul Kumar
Rahul Kumar - avatar
+ 2
Okay sir, if it is an object, then of which class??
19th Dec 2018, 7:05 PM
Rahul Kumar
Rahul Kumar - avatar
+ 2
Ohh sorry sir, I didn't know the rules.I will care about it.
19th Dec 2018, 7:31 PM
Rahul Kumar
Rahul Kumar - avatar
+ 1
One more question, If a protected member of a class gets inherited in its subclass, what would be its access modifier in sub claa? Will it still be protected or will it be changed to something else.?
19th Dec 2018, 7:38 PM
Rahul Kumar
Rahul Kumar - avatar