Jump to content

Wrong content in Java Tutorial

Recommended Posts

  • Java String Methods

    The description for intern() in the tutorial reads:

    Returns 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 of intern() reads:


    Returns a canonical representation for the string object.


  • Java Strings

    The Java Strings section contains:

    A String variable contains a collection of characters surrounded by double quotes:

    According to the JLS, 3.10.5. String Literals:

    A string literal consists of zero or more characters enclosed in double quotes.


    A string literal is a reference to an instance of class String.

    and since String implements CharSequence and states:

    The 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:  A String variable contains a sequence of characters (without the enclosing double quotes that form a string literal!).
    b) in detail: A String variable contains a reference to an object that represents a sequence of characters.
  • Java Modifiers

    The section Static contains:

    A static method means that it can be accessed without creating an object of the class, unlike public:


    An example to demonstrate the differences between static and public 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.
Edited by Gerold Broser
Link to post
Share on other sites

Two more:

  • Java Constructors

    The section Java Constructors says:

    If you do not create a class constructor yourself, [...] then you are not able to set initial values for object attributes.

    Considering JSL, 8.6. Instance Initializers this is not completely true.
  • Java Interface

    Notes on Interfaces in section Java Interface mentions:
    • On implementation of an interface, you must override all of its methods

    This is not true if an interface is implemented by an abstract class.

Edited by Gerold Broser
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...