A programmer tries to create a subclass of String called MyString. When the programmer compiles her new class, the compiler produces the following message:

```
MyString.java:1: cannot inherit from final java.lang.String
public class MyString extends String {
^
1 error
```

Explain the cause of this error.

The String class has been declared with the final modifier, which restricts any other classes from
extending it.

Computer Science & Information Technology

You might also like to view...

Suppose we have a weighted graph with n vertices, and at least n edges. Explain is wrong with the following approach for finding the minimum spanning tree: while(the number of edges in the graph >= n) find the edge with the highest weight and delete it from the graph

What will be an ideal response?

Computer Science & Information Technology

Write the statement to create a JLabel named welcome that holds the words "Welcome Home".

What will be an ideal response?

Computer Science & Information Technology