问题描述
`在这里输入代码`使用下面的代码来传递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);
}
}
推荐答案
这篇关于如何访问arraylist元素....................的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!