Gerold Broser Posted June 5, 2020 Share Posted June 5, 2020 (edited) Java String Methods The description for intern() in the tutorial reads: Quote 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: Quote Returns a canonical representation for the string object. Java Strings The Java Strings section contains: Quote A String variable contains a collection of characters surrounded by double quotes: According to the JLS, 3.10.5. String Literals: Quote 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: Quote 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: Quote 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 June 5, 2020 by Gerold Broser Link to comment Share on other sites More sharing options...
Gerold Broser Posted June 5, 2020 Author Share Posted June 5, 2020 (edited) Two more: Java Constructors The section Java Constructors says: Quote 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 InterfaceNotes on Interfaces in section Java Interface mentions: Quote 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 June 5, 2020 by Gerold Broser Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now