Gerold Broser
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Gerold Broser
-
-
-
Java String Methods
The description forintern()
in the tutorial reads:
QuoteReturns the index within this string of the first occurrence of the specified character, starting the search at the specified index
This is actually the short description of the overloading
indexOf(int ch, int fromIndex)
method. The actual short description ofintern()
reads:QuoteReturns a canonical representation for the string object.
-
Java Strings
The Java Strings section contains:
QuoteA
String
variable contains a collection of characters surrounded by double quotes:
According to the JLS, 3.10.5. String Literals:
QuoteA string literal consists of zero or more characters enclosed in double quotes.
[...]
A string literal is a reference to an instance of classString.
and sinceString
implementsCharSequence
and states:
QuoteThe
String
class represents character strings.
and since collection has a special meaning in Java the following would be more precise:
a) from a general point of view: AString
variable contains a sequence of characters (without the enclosing double quotes that form a string literal!).
b) in detail: AString
variable contains a reference to an object that represents a sequence of characters.
-
Java Modifiers
The section Static contains:
QuoteA
static
method means that it can be accessed without creating an object of the class, unlikepublic
:
[...]
An example to demonstrate the differences betweenstatic
andpublic
methods:
The difference between those two is that on methods the former defines an invocation scope (of class compared to object) and the latter is an access modifier (public compared to private, default or protected). These are two completely different concepts. So, comparing these two doesn't make any sense and is extremly misleading.
-
Java String Methods
Wrong content in Java Tutorial
in Suggestions
Posted · Edited by Gerold Broser
Two more:
The section Java Constructors says:
Considering JSL, 8.6. Instance Initializers this is not completely true.
Notes on Interfaces in section Java Interface mentions:
This is not true if an interface is implemented by an abstract class.