删除整个数组 [英] Deleting An Entire Array

查看:52
本文介绍了删除整个数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个用于对整数类型数组进行排序的程序,该程序涉及创建另一个相同大小的数组.排序后,没有使用新数组,因此我想完全摆脱它.到目前为止,我只发现了与删除特定类型的元素有关的问题.有帮助吗?

I have written a program for sorting an integer type array which involves the creation another array of the same size. After sorting, there is no use of the new array, so I want to completely get rid of it. So far, I've only found questions relating to the deletion of specific types of elements. Some help?

信息(如果需要):
原始数组: A [n]
新数组: B [n]
B [n] 必须完全删除.

Information (if needed):
Original Array: A[n]
New Array: B[n]
B[n] has to be completely deleted.

推荐答案

每当您离开执行排序的方法时,都会自动删除" temp数组(或更正确地说,已占用的内存可以进行垃圾回收).假设当然是在方法内部创建了临时数组.

The temp array will be "deleted" (or more correctly, the occupied memory will be eligible for garbage collection) automatically whenever you leave the method performing the sorting (assuming of course that the temp array is created inside the method).

Java 中几乎不需要显式的内存释放.

There is almost never any need for explicit memory deallocation in Java.

这篇关于删除整个数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆