![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JAVA--api
ainimaomi
这个作者很懒,什么都没留下…
展开
-
MessageFormat ---文字列に埋め込む情報
好用的MessageFormat类 收藏 因为工作的原因,经常使用C#,对于C#的String.Format()方法非常喜欢,能够格式化字符串,省掉了拼接字符串的烦恼,因而在想在java中有没有一个类似的功能呢?早就知道Java有SimpleDateFormat这个类,可以格式化日期,查看Java API知道DateFormat 是SimpleDateFormat的父类,再追查下去,又发现DateFormat 的父类是java.text.Format,而java.text.Format还有几个子类,其中一个转载 2010-07-01 12:44:00 · 87 阅读 · 0 评论 -
ResourceBunlde 读取property文件内容
<br />已知Message.properties文件中有一组key-value属性:<br />key = {0} is not found!<br /> <br />从该配置文件中读取键值为key的字符串,可以用ResourceBundle方法:<br />String key = "key";<br />ResourceBundle resource= PropertyResourceBundle.getBundle("Message");<br />String result = resourc原创 2010-07-01 13:59:00 · 375 阅读 · 0 评论 -
JAVA发射技术实现私有方法/字段的修改
<br />下面这个例子在实际项目中一般都不会这么用,只是用来说明怎么通过反射修改类的私有字段的值. <br />有一个类TestData: <br />public class TestData { <br />private String name = 1; <br />public String getName() { <br />return name; <br />} <br />} <br />在运行的时候怎么来修改name的值呢? <br />public class TestReflecti转载 2010-07-06 16:22:00 · 666 阅读 · 0 评论