问几个java问题
登录 | 论坛导航 -> 华新鲜事 -> 求学狮城 | 本帖共有 12 楼,当前显示第 3 楼 : 从楼主开始阅读 : 本帖树形列表 : 返回上一页
作者:香陵居士 (等级:16 - 好恐怖呀,发帖:22662) 发表:2004-06-29 21:46:34  3楼 
java tutorial from Sun is always a good resource to consult
First q: t is an local variable, t.MyString is accessing a member variable of t via t. Thus it is nothing related to public/protected/private limitation.


Second q: static initialization blocks are used for initilize a class member.

Note declaration also do the initialization for class member/instance member:
byte,short,int,long -> 0
float, double, -> 0.0
bool -> false
char -> empty character
object -> null


If you really want to access the thing in static{}, put static statements before define class member.

Seems you are doing SCJP, if yest, better read Java tutorial carefully.
最新推出专栏《倾听索罗斯》 欢迎大家前来捧场!

Yeah!
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表

本帖共有 12 楼,当前显示第 3 楼,本文还有 N-1 层楼,要不你试试看:点击此处阅读更多 >>



请登录后回复:帐号   密码