Java基础重温(九)-scjp

1.java code convertions:
字母、下划线、美元符号和数字组成。并且第一个字母不能为数字字符。


2.If the property is a boolean, the getter method's prefix is either get or is. For example, getStopped() or isStopped() are both valid JavaBeans names for

a boolean property.


3.The objective says you have to know legal identifiers only for variablenames, but the rules are the same for ALL Java components. So remember that a legal

identifier for a variable is also a legal identifi er for a method or a class. However, you need to distinguish between legal identifiers and naming conventions, such as the

JavaBeans standards, that indicate how a Java component should be named. In other words, you must be able to recognize that an identifier is legal even if it doesn’t conform to naming standards. If the exam question is asking about naming conventions—not just whether an identifier will compile—JavaBeans will be mentioned explicitly.]


4.Comments can appear at the beginning or end of any line in the source code file; they are independent of any of the positioning rules discussed here.


5.If there are import statements, they must go between the package statement (if there is one) and the class declaration. If there isn't a package statement,
then the import statement(s) must be the first line(s) in the source code file. If there are no package or import statements, the class declaration must be
the first line in the source code file.


6.Files with no public classes can have a name that does not match any of theclasses in the file.

7.Although all four access controls (which means all three modifiers) work for most method and variable declarations, a class can be declared with only public or

default access; the other two access control levels don't make sense for a class, as you'll see.


8.What does it mean to access a class? When we say code from one class (class A) has  access to another class (class B), it means class A can do one of three things:
■ Create an instance of class B.
■ Extend class B (in other words, become a subclass of class B).
■ Access certain methods and variables within class B, depending on the access control of those methods and variables.


9. For the exam, you need to know only thats trictfp is a keyword and can be used to modify a class or a method, but never a

variable,Marking a class as strictfp means that any method code in the class will conform to the IEEE 754 standard rules for floating points. Without that modifier,
floating points used in the methods might behave in a platform-dependent way. If you don't declare a class as strictfp, you can still get strictfp behavior on a
method-by-method basis, by declaring a method as strictfp. If you don't know the IEEE 754 standard, now's not the time to learn it. You have, as we say, bigger fish to

fry.


10.Why make a class if you can't make objects out of it? Because the class might be just too, well, abstract. For example, imagine you have
a class Car that has generic methods common to all vehicles. But you don't want anyone actually creating a generic, abstract Car object. How would they initialize its
state? What color would it be? How many seats? Horsepower? All-wheel drive? Or more importantly, how would it behave? In other words, how would the methods be
implemented?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值