public class Function {
static String a1_1[] = {"a","b","c","d"};
static String a2_2[] = {"a","b","c","d"}; public void tell( int i, int j ) {
System.out.println( ("a"+i+"_"+j)[0] );
}
public static void main(String[] args) { new Function().tell(1, 1);
}}为什么怎样取数组的元素有错误,有什么别的方法可以实现吗?
static String a1_1[] = {"a","b","c","d"};
static String a2_2[] = {"a","b","c","d"}; public void tell( int i, int j ) {
System.out.println( ("a"+i+"_"+j)[0] );
}
public static void main(String[] args) { new Function().tell(1, 1);
}}为什么怎样取数组的元素有错误,有什么别的方法可以实现吗?
解决方案 »
- 求高手。。jquery getJSON 跨域访问的同步问题。。。。。急!!!!!
- java 开钱柜,打印机
- <forward name 和 path 分别表示什么意思
- JFTP.jar的问题
- 用自己的类作为webservice的参数,不能反序列化的问题。
- 只用struts如何做级次的菜单树?
- 急!急!!一个JAVA问题,在线等待,忘帮忙!!
- 高分求解:WEB下打印有什么好办法?
- 在JBuilder中如何设置自己的EntityBean的类名
- java 文本信息处理(向一对标签中插入文字内容,或读出文本内容)
- 求助,运行不正确,怎么改?
- android官网上的SDK为什么下载不了,谁能给我传个吗?
public class Function {
static String a1_1[] = { "a ", "b ", "c ", "d " };
static String a2_2[] = { "a ", "b ", "c ", "d " }; public void tell(int i, int j) {
if(i == 1 && j == 1) {
System.out.println(a1_1[0]);
}
if(i == 2 && j == 2) {
System.out.println(a2_2[3]);
}
} public static void main(String[] args) { new Function().tell(2, 2);
}}看着楼主的代码很奇怪啊!