wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes interesting syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "interesting syntax" Watch "interesting syntax" New topic
Author

interesting syntax

Leonildo Campos
Ranch Hand

Joined: Jun 02, 2003
Posts: 33
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

Joined: May 16, 2003
Posts: 160
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

Joined: Dec 19, 2002
Posts: 229
I second Brian on this one!
Saket
 
GeeCON Prague 2014
 
subject: interesting syntax