Issue
Was checking lectures from this link :-
http://algs4.cs.princeton.edu/12oop/
It states Strings as ADT, I am confused why?
Solution
Probably you are confusing the general, programming-language-independent term "Abstract Data Type", and the Java-specific term "abstract class".
An Abstract Data Type is ... as described on the page you link to:
An abstract data type is a data type whose internal representation is hidden from the client.
A Java "abstract" class is a class that has the abstract
keyword in its class declaration. That means that you cannot make an instance of it.
These are two different ideas: two different meanings of the word "abstract".
So in the case of String
:
It is an ADT because the internal representation is hidden.
It is NOT an
abstract
class:new String("42")
works for example.
Answered By - Stephen C