wood burning stoves 2.0
The moose likes Beginning Java and the fly likes What is Strongly Typed? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is Strongly Typed?" Watch "What is Strongly Typed?" New topic

What is Strongly Typed?

Ram Venkata

Joined: Apr 10, 2007
Posts: 8
Can anyone explain me what do we mean by Strongly Typed?

Sidd Kulk
Ranch Hand

Joined: Feb 20, 2007
Posts: 152
Hi Ram, Welcome to Javaranch!!

Strongly typed is a characteristic of a language, because of which it becomes imperative to specify the type of variables. And it makes the inter type conversions bound by strict laws. It is applicable to both, primitives, as well as reference variables. You cannot assign a float to an int(of course, the other way round is possible because of implicit widening), and similarly, you can't assign a Dog reference to a Cat object, because they are of different TYPES.


[ May 02, 2007: Message edited by: Sidd Kulk ]
Ram Venkata

Joined: Apr 10, 2007
Posts: 8
Thanks Sidd
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
We have to very carefully distinguish between three mostly orthogonal concepts here:

Static Typing means that *references* have types, that are checked at compile time. That is, the compiler checks that you don't assign incompatible types - you can't assign a Dog reference to a Cat reference. The opposite is Dynamic Typing. Java and C++ are statically typed languages, Ruby and Smalltalk dynamically typed, for example.

Strong Typing means that *objects* have types, that are checked at runtime. That is, the runtime environment checks that you don't send messages to objects that don't support those messages. The opposite is weak typing. Java and Smalltalk are strongly typed, basic C++ is weakly typed (although modern implementations add support for strong typing, if I remember correctly).

Manifest Typing means that you need to declare the type of references. The opposite is latent typing, where the (static) type of a reference is infered by the compiler. Java is manifestly typed, Scheme is an example of a latently typed language.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree. Here's the link: http://aspose.com/file-tools
subject: What is Strongly Typed?
It's not a secret anymore!