Forums Register Login

interesting syntax

+Pie Number of slices to send: Send
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.**
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
I second Brian on this one!
Saket
There's a way to do it better - find it. -Edison. A better tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 449 times.
Similar Threads
instance initializer variable question
[liferay] My sample project
Help on String methods!!!
Address Book Java Issues
I am getting "void type not allowed here" error
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:35:31.