• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

ArrayList

 
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Initial size of al: 0
size of al after additions 7
contents of al: [C, A2, A, E, B, D, F]
size of after deletions : 5
contents of al:[C, A2, E, B, D] [1, 2, 3, 4]

May you explain about this output:
[1, 2, 3, 4]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

abalfazl hossein wrote:...
May you explain about this output:
[1, 2, 3, 4]


I have no idea. That does not appear when I run your code.
 
Ranch Hand
Posts: 61
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

marc weber wrote:

abalfazl hossein wrote:...
May you explain about this output:
[1, 2, 3, 4]


I have no idea. That does not appear when I run your code.



Yup, It doesn't appear to me either...
 
Ranch Hand
Posts: 87
Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abalfazl , have you posted the same code which you are running?
Looks like there was a System.out.print statement after line 33 which prints another list.
You might have removed that statement and then directly ran it (but forgot to compile the modified code before running it).

Also,


You can use a single statement instead of the above two statements.

println() adds a line separator et the end of the output automatically.
 
rubbery bacon. crispy tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic