Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > is Java dynamically or statically typed language or both?

Reply
Thread Tools

is Java dynamically or statically typed language or both?

 
 
puzzlecracker
Guest
Posts: n/a
 
      12-29-2005
Is it different from c++ in this regard?

Thx

 
Reply With Quote
 
 
 
 
Hal Rosser
Guest
Posts: n/a
 
      12-29-2005

"puzzlecracker" <> wrote in message
news: oups.com...
> Is it different from c++ in this regard?
>
> Thx
>

Strongly typed


 
Reply With Quote
 
 
 
 
puzzlecracker
Guest
Posts: n/a
 
      12-30-2005

Hal Rosser wrote:
> "puzzlecracker" <> wrote in message
> news: oups.com...
> > Is it different from c++ in this regard?
> >
> > Thx
> >

> Strongly typed


elaborate on how it relates to dynamically or statically typed
concepts.

rhx

 
Reply With Quote
 
Michael Redlich
Guest
Posts: n/a
 
      12-30-2005
Hi puzzlecracker:

puzzlecracker wrote:
> Is it different from c++ in this regard?
>


Java is statically typed because dynamically typed languages (such as
JavaScript and Visual Basic) allow you to write code like this:

var fred = "Fred";
//...
fred = 3.5;

This would obviously be illegal in Java and C++.

More details can be found at http://en.wikipedia.org/wiki/Data_type

Hope this helps...

Mike.

 
Reply With Quote
 
puzzlecracker
Guest
Posts: n/a
 
      12-30-2005

Michael Redlich wrote:
> Hi puzzlecracker:
>
> puzzlecracker wrote:
> > Is it different from c++ in this regard?
> >

>
> Java is statically typed because dynamically typed languages (such as
> JavaScript and Visual Basic) allow you to write code like this:
>
> var fred = "Fred";
> //...
> fred = 3.5;
>
> This would obviously be illegal in Java and C++.
>
> More details can be found at http://en.wikipedia.org/wiki/Data_type
>
> Hope this helps...
>
> Mike.



Thanks... that does it


Would an automatic registering of delegates make a language
dynamically typed?

 
Reply With Quote
 
Stefan Schulz
Guest
Posts: n/a
 
      12-30-2005
On Thu, 29 Dec 2005 16:21:43 -0800, puzzlecracker wrote:

>
> Hal Rosser wrote:
>> "puzzlecracker" <> wrote in message
>> news: oups.com...
>> > Is it different from c++ in this regard?
>> >
>> > Thx
>> >

>> Strongly typed

>
> elaborate on how it relates to dynamically or statically typed
> concepts.


Take some time and read
http://en.wikipedia.org/wiki/Datatype

This should answer most of the questions you are likely to ask in short
order

See you
Stefan

--
You can't run away forever,
But there's nothing wrong with getting a good head start.
--- Jim Steinman, "Rock and Roll Dreams Come Through"


 
Reply With Quote
 
egao1980@gmail.com
Guest
Posts: n/a
 
      12-30-2005
Java is strongly typed with some hole near collections (patched with
generics in java 5.0) but It is possible to write "dynamically
typed"-like code in Java - declare all variables as Object and use
reflection to call methods an do other things around ^_^ (similar to
Smalltalk but ugly in syntax)

 
Reply With Quote
 
Michael Redlich
Guest
Posts: n/a
 
      12-30-2005
Hi "egao1980":

wrote:
> Java is strongly typed with some hole near collections (patched with
> generics in java 5.0) but It is possible to write "dynamically
> typed"-like code in Java - declare all variables as Object and use
> reflection to call methods an do other things around ^_^ (similar to
> Smalltalk but ugly in syntax)


I hear what you're saying, but I still think there is a big difference
between declaring variables as type Object and variables in dynamically
typed (scripting) languages.

Type Object is still just that, a type. As you probably already know,
a cast is usually required to change over to a more specific type (like
iterating through a collection before Generics). Reflection, of
course, also deals with specific class types.

On the other hand, variables declared in a scripting language can be
dynamically assigned to another data type (like the example I gave
earlier in this thread) without the need for casting. But, one has to
wonder how all that magic happens in the background.

So, you bring up an interesting point.

Here's something for all of us to ponder for the new year...

Happy New Year!

Mike.

--- ACGNJ Java Users Group (http://www.javasig.org/)

 
Reply With Quote
 
Michael Redlich
Guest
Posts: n/a
 
      12-30-2005
Hi puzzlecracker:

puzzlecracker wrote:
>
>
> Thanks... that does it
>
>
> Would an automatic registering of delegates make a language
> dynamically typed?


Can I assume that you are referring to C#?

I haven't made the plunge into the whole .NET thing, but I am aware of
the 'delegate' keyword. I did some surfing, and found the following
from Microsoft's MSDN page:

"A delegate declaration defines a reference type that can be used to
encapsulate a method with a specific signature. A delegate instance
encapsulates a static or an instance method. Delegates are roughly
similar to function pointers in C++; however, delegates are type-safe
and secure."

More details can be found at:

http://msdn.microsoft.com/library/de...legateType.asp

Hope this helps...

Happy New Year!

Mike.

--- ACGNJ Java Users Group (http://www.javasig.org/)

 
Reply With Quote
 
puzzlecracker
Guest
Posts: n/a
 
      12-30-2005

Michael Redlich wrote:
> Hi puzzlecracker:
>
> puzzlecracker wrote:
> >
> >
> > Thanks... that does it
> >
> >
> > Would an automatic registering of delegates make a language
> > dynamically typed?

>
> Can I assume that you are referring to C#?
>
> I haven't made the plunge into the whole .NET thing, but I am aware of
> the 'delegate' keyword. I did some surfing, and found the following
> from Microsoft's MSDN page:
>
> "A delegate declaration defines a reference type that can be used to
> encapsulate a method with a specific signature. A delegate instance
> encapsulates a static or an instance method. Delegates are roughly
> similar to function pointers in C++; however, delegates are type-safe
> and secure."
>
> More details can be found at:
>
> http://msdn.microsoft.com/library/de...legateType.asp
>
> Hope this helps...
>
> Happy New Year!
>
> Mike.
>
> --- ACGNJ Java Users Group (http://www.javasig.org/)



C# has but it also an implementation detail usually in adapter
pattern: you create a delegate which can be used to manipulate adaptee.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mix statically typed with dynamically typed Yingjie Lan Python 4 01-29-2010 08:50 AM
is C++ dynamically or statically typed language or both? puzzlecracker C++ 4 12-25-2005 09:57 AM
How can I add a row from a typed datatable to another instance of that typed datatable? Ersin Gençtürk ASP .Net 1 10-06-2004 01:11 PM
Boo: Statically typed Python with type inference is done (well, kinda ;-) Ville Vainio Python 2 07-16-2004 05:21 PM
"The VMs are designed for statically typed languages..."... Enrique Meza Ruby 0 07-24-2003 09:49 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57