不过 查了官方api, indexOf的解释
int indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character.
求解释啊。。。
int indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character.
求解释啊。。。
2016-05-30
我还抄笔记呢。。。
第一个indexOf方法参数类型写了int,当时就蒙了
看评论果然很多挑错的啊,,
第一个indexOf方法参数类型写了int,当时就蒙了
看评论果然很多挑错的啊,,
2016-05-30
最新回答 / 缘来是你
public void testAdd(){ Course cr=new Course("1","c sharp"); courseToSelect.add(cr); Course temp=(Course)courseToSelect.get(0); System.out.println("the add test is: "+cr.id+":"+cr.name); Course cr1=new Course("2","my sql"); courseToSelect.add(0, cr1)...
2016-05-29
List<Integer>list = new ArrayList<Integer>();
Integer k;
for(int i = 0;i<3;i++){
do{
k = ran.nextInt(1000);
}while(list.contains(k));
list.add(k);
}
studentList.add(new student(list.get(0)+"", "Mike"));
Integer k;
for(int i = 0;i<3;i++){
do{
k = ran.nextInt(1000);
}while(list.contains(k));
list.add(k);
}
studentList.add(new student(list.get(0)+"", "Mike"));
2016-05-29
http://www.imooc.com/opus/resource?opus_id=2963自己写的,感觉还有好多不足,希望大家多多指出,小白一枚,共同进步
2016-05-29
这里的HashMap对象student里的key是ID,value是一个Student对象,Student对象也有ID属性,让人容易混淆。
还有判断有没有包含学生用containsKey(ID)就行了,用get(ID),然后判断是否为null不合理吧
还有判断有没有包含学生用containsKey(ID)就行了,用get(ID),然后判断是否为null不合理吧
2016-05-29
已采纳回答 / 慕粉3225359
因为有private只能在当前类对变量进行操作,对数据的保护很好,当你要对变量进行操作是,不在当前类的话,要改变变量的值就不能用xx.name=xx来直接赋值,而要用set方法,同理你要得到某个变量的值也要用get方法。
2016-05-29