Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interesting syntax

 
Leonildo Campos
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We can do it in java:
public class Sample {
public static void main(String [] args) {
int index = 1;
String name = new String[] {"Sonia", "Leonildo", "Lisa"} [index] ;
System.out.println("My name is " + name);
}
}
this code produces the output:
% java Sample
My name is Leonildo
**Be careful with that on exam.**
 
Brian Joseph
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to see a page on all the various ways you can create arrays, particularly multi-dimensional. Some of Dan's questions involve this and some valid creation statements freaked me out.
 
Saket Barve
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I second Brian on this one!
Saket
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic