• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

arrays

 
Ranch Hand
Posts: 144
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

could you please tell me from which class we get the variable and method which are shown in the code below?
are they inherited from Object class? or they are from Arrays class? in API ,,, because i searced both but i couldn't find them

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Every array object is an instance of an internally generated class which is an implicit extension of the Object class. This class has a public, final property called length. The JVM assigns to this property, the value that you specify when you instantiate an array. For example, the length of this array is 12



The equals() method is the one defined in the String class.
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For clarifications on the length attribute please go through this

This is something new to me. Never thought about it.
 
Ogeh Ikem
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

bhanu chowdary wrote:For clarifications on the length attribute please go through this



That's good but an even better reference is the Java Language Specification.
 
Hama Kamal
Ranch Hand
Posts: 144
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



hi, thank you guys for the your replies,,, i just noted that this code does not compile however when you make it
it works fine ,,,,,,, maybe autoboxing does not work here.
 
Ogeh Ikem
Ranch Hand
Posts: 180
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hama Kamal, you might find this useful https://coderanch.com/t/260284/java-programmer-SCJP/certification/Object-new-int
 
Hama Kamal
Ranch Hand
Posts: 144
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ogeh Ikem wrote:Hama Kamal, you might find this useful https://coderanch.com/t/260284/java-programmer-SCJP/certification/Object-new-int



thanks my friend it is really useful,, i got it.
 
Ogeh Ikem
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're Welcome.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic