当前位置:网站首页>校园兼职平台项目反思
校园兼职平台项目反思
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));
}
边栏推荐
- How can users overcome emotional issues in programmatic trading?
- 2022-08-10 The sixth group Hiding spring study notes
- 什么是机器强化学习?原理是什么?
- Enter the starting position, the ending position intercepts the linked list
- The "top pillar" slides, and new growth is extremely difficult to shoulder the heavy responsibility. Is Ali "squatting" to jump higher?
- LeetCode热题(12.买卖股票的最佳时机)
- STC8H development (15): GPIO drive Ci24R1 wireless module
- typedef defines the structure array type
- How to rebuild after pathman_config and pathman_config_params are deleted?
- Read the article, high-performance and predictable data center network
猜你喜欢
STC8H开发(十五): GPIO驱动Ci24R1无线模块
EasyCVR接入GB28181设备时,设备接入正常但视频无法播放是什么原因?
E-commerce project - mall time-limited seckill function system
Unity2D animation (1) introduction to Unity scheme - animation system composition and the function of use
The last update time of the tables queried by the two nodes of the rac standby database is inconsistent
Echart地图的省级,以及所有地市级下载与使用
【FPGA】名词缩写
【FPGA】day18-ds18b20实现温度采集
Is Redis old?Performance comparison between Redis and Dragonfly
【愚公系列】2022年08月 Go教学课程 035-接口和继承和转换与空接口
随机推荐
浅析一下期货程序化交易好还是手工单好?
Build Zabbix Kubernetes cluster monitoring platform
The development of the massage chair control panel makes the massage chair simple and intelligent
How to rebuild after pathman_config and pathman_config_params are deleted?
STC8H开发(十五): GPIO驱动Ci24R1无线模块
Roewe imax8ev cube battery security, what blackening and swelling are hidden behind it?
uni-app - 城市选择索引列表 / 通过 A-Z 排序的城市列表(uview 组件库 IndexList 索引列表)
构建程序化交易系统需要注意什么问题?
Audio codec, using FAAC to implement AAC encoding
2022-08-10 The sixth group Hiding spring study notes
What kind of programming trading strategy types can be divided into?
The last update time of the tables queried by the two nodes of the rac standby database is inconsistent
The solution to the height collapse problem
音频编解码,利用FAAC来实现AAC编码
[C Language] Getting Started
一文读懂 高性能可预期数据中心网络
Description of ESB product development steps under cloud platform
[yu gong series] Go program 035-08 2022 interfaces and inheritance and transformation and empty interface
MYSQLg advanced ------ return table
leetCode刷题14天二叉树系列之《 110 平衡二叉树判断》