diff --git a/javaguide.html b/javaguide.html index 59f03dc..b171426 100644 --- a/javaguide.html +++ b/javaguide.html @@ -346,11 +346,16 @@ applies to both code and comments throughout the block. (See the example in Sect
Java code has a column limit of 100 characters. +
Java code has a column limit of 100 characters. A "character" means any Unicode code point. Except as noted below, any line that would exceed this limit must be line-wrapped, as explained in Section 4.5, Line-wrapping.
+Each Unicode code point counts as one character, even if its display width is +greater or less. For example, if using +fullwidth characters, +you may choose to wrap the line earlier than where this rule strictly requires.
+Exceptions:
Every variable declaration (field or local) declares only one variable: declarations such as
int a, b;
are not used.
Exception: Multiple variable declarations are acceptable in the header of a
+for
loop.
Local variables are not habitually declared at the start of their containing
@@ -842,15 +850,17 @@ with Test
. For example,
stop
.
Underscores may appear in JUnit test method names to separate logical components of the
-name. One typical pattern is test<MethodUnderTest>_<state>
,
-for example testPop_emptyStack
. There is no One Correct
+name, with each component written in lowerCamelCase.
+One typical pattern is <methodUnderTest>_<state>
,
+for example pop_emptyStack
. There is no One Correct
Way to name test methods.
Constant names use CONSTANT_CASE
: all uppercase
-letters, with words separated by underscores. But what is a constant, exactly?
Constants are static final fields whose contents are deeply immutable and whose methods have no detectable side effects. This includes primitives, Strings, immutable types, and immutable