帮助这个asap,重写Object类方法 [英] Help with this asap, Overriding Object class methods

查看:78
本文介绍了帮助这个asap,重写Object类方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类Connection维护属性数据库URL,用户名和密码。类需要维护Connection类的计数。每次创建连接对象时,必须递增计数,并且每次将其设置为null时,必须递减计数,并且必须通过代码显式地对对象进行垃圾回收。在任何时候,内存中只能有10个连接对象。编写一个java类来实现这一点。

A class Connection maintains attributes database url, user name and password. Class needs to maintain the number of count of Connection class. Every time a connection object is created the count must be incremented and every time it is set to null count must be decremented and object must be garbage collected explicitly by the code. At any point, there must be only 10 connection object in the memory. Write a java class to achieve this.

推荐答案

我们不做你的作业:它是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


这篇关于帮助这个asap,重写Object类方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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