问下这是什么?NameBean.class.getResource();

ai92 2004-04-21 11:26:55
刚刚开始J2EE 之旅
在看书中看到不解之处,请大家关照
关键代码如下:
public class WeatherBean implements Serializable
{
……………………
private static Properties imageName;
……………………
URL url=WeatherBean.class.getResource("imagenames.properties");
……………………
}

问:1,这个Serializable谁用过,我看了文档也不是很明白
2,WeatherBean.class.getResource("imagenames.properties");怎么理解??
...全文
83 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wjzmy 2004-04-22
  • 打赏
  • 举报
回复
呵呵,为什么这样写?你可以到帮助文件里面去找一找,这个应该是一个类里面的一个用法,我想具体使用方法和使用的参数里面都应该提供
ai92 2004-04-22
  • 打赏
  • 举报
回复
我再顶
ai92 2004-04-21
  • 打赏
  • 举报
回复
我晕,不会的顶一下啊,有分的~~~~~~~~~
ai92 2004-04-21
  • 打赏
  • 举报
回复
我顶~~~~~~~~~~
ai92 2004-04-21
  • 打赏
  • 举报
回复
谢谢楼上的GG们
祝你们能美女在怀,钞票在兜~~~~~~~~~~
不过麻烦你们给我仔细将将吧

我想知道为什么WeatherBean.class.getResource这样写,在哪里能找到这样的资料?
Jdk文档里的什么位置有阿
dreamnear 2004-04-21
  • 打赏
  • 举报
回复
Serializable是指将WeathBean对象序列化
序列化的对象可以用来实现数据的持久。楼主可以看看《深入java虚拟机》上面讲得很详细。
WeatherBean.class.getResource("imagenames.properties");
Finds a resource with a given name. This method returns null if no resource with this name is found. The rules for searching resources associated with a given class are implemented by the * defining class loader of the class.
baichuan168 2004-04-21
  • 打赏
  • 举报
回复
Serializable是指将WeathBean对象序列化
WeatherBean.class.getResource("imagenames.properties");得到配置文件地址

67,538

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧