在Java编程中的实用工具类 [英] Utility Classes in Java Programming

查看:151
本文介绍了在Java编程中的实用工具类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Java和我提到关于我的问题上了网,但不太满意。我想知道什么是工具类,在Java是?

I am new to Java and I referred regarding my question on the Net but not quite Satisfied. I want to know what the "Utility Class" in Java is?

谁能告诉我举个例子。

谢谢, 大卫

推荐答案

这通常是一个类,只有静态方法(可能带有私有构造函数和抽象标记/决赛中以prevent实例/子类)。它只存在使其他类更容易使用 - 例如,提供了一堆静态方法来处理与字符串值,执行额外的行动,字符串本身不支持。

It's usually a class which only has static methods (possibly with a private constructor and marked abstract/final to prevent instantiation/subclassing). It only exists to make other classes easier to use - for example, providing a bunch of static methods to work with String values, performing extra actions which String itself doesn't support.

工具类一般不上,你可以控制类操作,否则你会通常把行为直接该类中。他们不是非常整齐OO术语,但是仍然可以快乐有益的。

Utility classes generally don't operate on classes you have control over, as otherwise you'd usually put the behaviour directly within that class. They're not terribly neat in OO terms, but can still be jolly useful.

这篇关于在Java编程中的实用工具类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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