如何访问arraylist元素.................... [英] how can access arraylist elements....................

查看:608
本文介绍了如何访问arraylist元素....................的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

`在这里输入代码`使用下面的代码来传递arraylist中的访问值但是那部分代码显示错误clld =(classloaddata).passingloadeddata [0]; illigle类型开始









{ArrayList passingloadeddata = new ArrayList ();

/ **创建新表单问题* /

公共问题(ArrayList PassingQuestion){

passingloadeddata = PassingQuestion;

initComponents();

}

public void loadingdata {

classloaddata clld = new classloaddata();

clld =(classloaddata).passingloadeddata [0];

lblshowques.setText(clld.Question);

rdiobtnop1.setText(clld.Op1);

rdiobtnop1.setText(clld.Op2) ;

rdiobtnop1.setText(clld.Op3);

rdiobtnop1.setText(clld.Op4);

}

}

`enter code here`using the below code for access values in passing arraylist but that part of code showing error clld=(classloaddata).passingloadeddata[0]; illigle start of types




{ArrayList passingloadeddata= new ArrayList();
/** Creates new form Questions */
public Questions(ArrayList PassingQuestion) {
passingloadeddata=PassingQuestion;
initComponents();
}
public void loadingdata {
classloaddata clld= new classloaddata();
clld=(classloaddata).passingloadeddata[0];
lblshowques.setText(clld.Question);
rdiobtnop1.setText(clld.Op1);
rdiobtnop1.setText(clld.Op2);
rdiobtnop1.setText(clld.Op3);
rdiobtnop1.setText(clld.Op4);
}
}

推荐答案

尝试 Java.util.ArrayList .get()方法 [ ^ ] - 它可能对你有帮助。
Try Java.util.ArrayList.get() Method[^] - it might help you.


这篇关于如何访问arraylist元素....................的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆