• Post Reply Bookmark Topic Watch Topic
  • New Topic

Array question  RSS feed

 
Heather Carey
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this code below where I have int[] music = new int[7]; in red - that is an array.
Is the code right below that, String[] notes = {{"A", "B", "C", "D", "E", "F", "G"}; in blue - is this also an array that is being initialized at the same time?? The new operator is not used in the blue text, so does that not make it an array? Sorry - but I'm reading Introduction to JAVA Programming 8th ed, Y. Daniel Liang page 201, 6.2.5 Array Initializers and from what I'm reading (if I understand it correctly) it looks like I have made two arrays in my code below (which I don't really want to do).


 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you can see, color doesn't work in code listings so it's best to refer to code fragments by line number rather than by trying to color it.

And yes, you have created two arrays, one initialized, one not.
 
Heather Carey
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Bear.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!