当前位置:网站首页>校园兼职平台项目反思
校园兼职平台项目反思
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));
}

边栏推荐
- C语言 recv()函数、recvfrom()函数、recvmsg()函数
- MYSQLg advanced ------ clustered and non-clustered indexes
- Is there any way for kingbaseES to not read the system view under sys_catalog by default?
- The FTP error code list
- 移动端地图开发选择哪家?
- Leetcode 108. 将有序数组转换为二叉搜索树
- 程序化交易改变了什么?
- DNS separation resolution and intelligent resolution
- When EasyCVR is connected to the GB28181 device, what is the reason that the device is connected normally but the video cannot be played?
- 常见布局效果实现方案
猜你喜欢

【FPGA】SDRAM

2022-08-10 The sixth group Hiding spring study notes
![[FPGA] day19- binary to decimal (BCD code)](/img/d8/6d223e5e81786335a143f135385b08.png)
[FPGA] day19- binary to decimal (BCD code)

A simple JVM tuning, learn to write it on your resume

Detailed explanation of VIT source code

没想到MySQL还会问这些...

【FPGA】day19-二进制转换为十进制(BCD码)

The last update time of the tables queried by the two nodes of the rac standby database is inconsistent

机器学习怎么学?机器学习流程

机器学习是什么?详解机器学习概念
随机推荐
js uses the string as the js execution code
高校就业管理系统设计与实现
LeetCode刷题第12天二叉树系列之《104 二叉树的最大深度》
.NET自定义中间件
console.log alternatives you didn't know about
FTP错误代码列表
【FPGA】abbreviation
What is ensemble learning in machine learning?
Map中的getOrDefualt方法
音频编解码,利用FAAC来实现AAC编码
Multi-serial port RS485 industrial gateway BL110
C language recv() function, recvfrom() function, recvmsg() function
Power Cabinet Data Monitoring RTU
typedef定义结构体数组类型
Paper Accuracy - 2017 CVPR "High-Resolution Image Inpainting using Multi-Scale Neural Patch Synthesis"
"110 Balanced Binary Tree Judgment" in leetCode's 14-day binary tree series
A simple JVM tuning, learn to write it on your resume
什么是机器强化学习?原理是什么?
rub the heat - do not open
Rotary array problem: how to realize the array "overall reverse, internal orderly"?"Three-step conversion method" wonderful array