public List<UserPhoto> getUserPhotos(Integer totalCount)
{
totalCount=100;
List<UserPhoto> photos = new List<UserPhoto>();
return photos;
}public void main()
{
Integer total = 0;
List<UserPhoto> photos = getUserPhotos(total);
System.out.print(total);-------------我想要的结果是100,但实际值是0
}
{
totalCount=100;
List<UserPhoto> photos = new List<UserPhoto>();
return photos;
}public void main()
{
Integer total = 0;
List<UserPhoto> photos = getUserPhotos(total);
System.out.print(total);-------------我想要的结果是100,但实际值是0
}
解决方案 »
- webService 小小一问
- hibernate做多表映射有什么优点?
- 请问在flex中获取触发事件 的控件的相关属性?
- 用java写个小的网页游戏,需要哪些东西啊?能告诉我一下具体的步骤吗?谢谢了
- 水晶报表图表中的中文显示乱码
- 刚做了一个JAVAMAIL的邮件收收程序,用SOHU的STMP能完成收发,但我用自己注册的DNS域名替换时就不行
- 数据类型?
- 解决了马上送分:jbuilder9环境下开发struts遇到的中文乱码问题
- 有谁会解决吗?散分!共(140分)
- Filter [springSecurityFilterChain]: could not be initialized
- 关于强制输出
- 关于jsp的一个菜鸟级问题
Integer total = 0; 没有变。
private int current=1; //当前页码
private int totalCount=1; //总记录数
private int pageSize=10; //每页显示行数
//setter,getter方法省略
public int getPageCount(){
return (totalCount-1)/pageSize+1;
}
}public class Test{
public List <UserPhoto> getUserPhotos(PageSupport page){
page.setTotalCount=100;
List <UserPhoto> photos = new List <UserPhoto>();
return photos;
}
public static void main(String[] args){
PageSupport page=new PageSupport();
List <UserPhoto> photos = getUserPhotos(page);
System.out.println(page.getTotalCount());//----------这样就正确了
System.out.println(page.getPageCount()); //-----------取得总页数
}
}
放在全局变量里就可以了。
List <UserPhoto> photos = new List <UserPhoto>();
这里不正确吧
List <UserPhoto> photos = new ArrayList <UserPhoto>();
* Demo.java
*
* 工程:spring_second
* 功能: TODO
*
* author lifeiscool
* date 2009-8-25
* time 下午03:38:18
*
* Copyright (c) 2009, TNT All Rights Reserved.
*/public class Demo { public static void main(String[] args) {
myInt total = new myInt(0);
getUserPhotos(total);
System.out.print(total);
} public static void getUserPhotos(myInt totalCount) {
totalCount.setInt(100);
}
}class myInt {
int a; myInt(int a) {
this.a = a;
} public int getInt() {
return a;
} public void setInt(int b) {
a = b;
} myInt(myInt a) {
this.a = a.getInt();
} public String toString() {
return "" + a;
}
}