当前位置:网站首页>校园兼职平台项目反思
校园兼职平台项目反思
2022-08-11 03:52:00 【沐风游云】
一、用IO流时一定要先序列化再反序列化
二、使用ArrayList集合add方法追加数据时会将前面的数据覆盖成新加入的数据
解决方法:在循环体内new ArrayList集合
三、定义实体类参数类型时,考虑后续是否会出现输入类型不一致错误
解决方法:直接定义成String类型,需要什么类型再转。如:String转int用Integer.parseInt(str)等。
四、传参问题
1、如果传递的是基本类型,那么传过来的就是这个参数的一个副本,也就是这个原始参数的值,如果在函数中改变了副本的值不会改变原始的值。
2、如果传递的是引用类型,那么传过来的就是这个引用参数的副本,这个副本存放的是参数的地址。如果在函数中没有改变这个副本的地址,而是通过地址改变改变了地址指向的值,那么在函数内的改变会影响到传入的参数。
3、如果在函数中改变了副本的地址,如当执行如a=其他对象,a=new等赋值操作时,实际上是将a指向新的位置,那么函数外的原值不改变。
传递参数的两种方式:
1、值传递
public static void fun(int x){
x=100;
System.out.println("x="+x);
}
public static void main(String[] args) {
int a=10;
fun(a);
System.out.println("a="+a);
}
2、引用传递
public static void test(int[] newarray){
newarray=new int[]{
10,20,30};
}
public static void main(String[] args) {
int[]array={
1,2,3};
test(array);
System.out.println(Arrays.toString(array));
}
边栏推荐
- STC8H development (15): GPIO drive Ci24R1 wireless module
- 使用jackson解析json数据详讲
- LeetCode刷题第10天字符串系列之《125回文串验证》
- What has programmatic trading changed?
- 移动端地图开发选择哪家?
- How can users overcome emotional issues in programmatic trading?
- What is ensemble learning in machine learning?
- Build Zabbix Kubernetes cluster monitoring platform
- The FTP error code list
- Design and Realization of Employment Management System in Colleges and Universities
猜你喜欢
机器学习中什么是集成学习?
使用jackson解析json数据详讲
获取Qt的安装信息:包括安装目录及各种宏地址
Binary tree related code questions [more complete] C language
leetcode刷题第13天二叉树系列之《98 BST及其验证》
云平台下ESB产品开发步骤说明
你不知道的 console.log 替代品
leetCode刷题14天二叉树系列之《 110 平衡二叉树判断》
Rotary array problem: how to realize the array "overall reverse, internal orderly"?"Three-step conversion method" wonderful array
Graphical LeetCode - 640. Solving Equations (Difficulty: Moderate)
随机推荐
En-us is an invalid culture error solution when Docker links sqlserver
Graphical LeetCode - 640. Solving Equations (Difficulty: Moderate)
作业8.10 TFTP协议 下载功能
机器学习怎么学?机器学习流程
Description of ESB product development steps under cloud platform
What has programmatic trading changed?
“顶梁柱”滑坡、新增长极难担重任,阿里“蹲下”是为了跳更高?
【FPGA】day20-I2C读写EEPROM
STC8H开发(十五): GPIO驱动Ci24R1无线模块
What should I do if the channel ServerID is incorrect when EasyCVR is connected to a Hikvision Dahua device and selects another cluster server?
高度塌陷问题的解决办法
The custom of the C language types -- -- -- -- -- - structure
【FPGA】day19-二进制转换为十进制(BCD码)
App Basic Framework Construction丨Log Management - KLog
shell监视gpu使用情况
uni-app - city selection index list / city list sorted by A-Z (uview component library IndexList index list)
[FPGA] Design Ideas - I2C Protocol
"104 Maximum Depth of Binary Trees" in LeetCode's Day 12 Binary Tree Series
QueryDet: Cascading Sparse Query Accelerates Small Object Detection at High Resolution
Watch to monitor