Skip to content

Make unified-types.md more intuitive to new comers #670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Feb 9, 2017
Prev Previous commit
Next Next commit
Update unified-types.md
  • Loading branch information
shogowada authored Feb 2, 2017
commit ef5493dd8085062471c32899c1562fd929ea334c
6 changes: 3 additions & 3 deletions tutorials/tour/unified-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ next-page: classes
previous-page: tour-of-scala
---

In Scala, all values are instance of a class, including numerical values and functions. The diagram below illustrates the class hierarchy.
In Scala, all values are instances of a class, including numerical values and functions. The diagram below illustrates the class hierarchy.

![Scala Type Hierarchy]({{ site.baseurl }}/resources/images/classhierarchy.img_assist_custom.png)

## Scala Class Hierarchy ##

The superclass of all classes `scala.Any` has two direct subclasses: `scala.AnyVal` and `scala.AnyRef`.

`scala.AnyVal` represents value classes. All value classes are not nullable and predefined; they correspond to the primitive types of Java-like languages. Note that the diagram above also shows implicit conversions between the value classes.
`scala.AnyVal` represents value classes. All value classes are non-nullable and predefined; they correspond to the primitive types of Java-like languages. Note that the diagram above also shows implicit conversions between the value classes.

`scala.AnyRef` represents reference classes. All non-value classes are defined as reference class. Every user-defined class in Scala implicitly extends `scala.AnyRef`. If Scala is used in the context of a Java runtime environment, `scala.AnyRef` corresponds to `java.lang.Object`.

Expand All @@ -44,7 +44,7 @@ The application defines a variable `list` of type `List[Any]`. The list is initi

Here is the output of the program:

```tut
```
a string
732
c
Expand Down