Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

is Java dynamically or statically typed language or both?

Thread view: 
puzzlecracker - 29 Dec 2005 22:32 GMT
Is it different from c++ in this regard?

Thx
Hal Rosser - 29 Dec 2005 23:57 GMT
> Is it different from c++ in this regard?
>
> Thx

Strongly typed
puzzlecracker - 30 Dec 2005 00:21 GMT
> > Is it different from c++ in this regard?
> >
> > Thx
> >
> Strongly typed

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

rhx
Stefan Schulz - 30 Dec 2005 14:56 GMT
>> > Is it different from c++ in this regard?
>> >
[quoted text clipped - 4 lines]
> 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

Signature

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"
         

egao1980@gmail.com - 30 Dec 2005 16:24 GMT
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)
Michael Redlich - 30 Dec 2005 18:01 GMT
Hi "egao1980":

> 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/)
Michael Redlich - 30 Dec 2005 02:33 GMT
Hi puzzlecracker:

> 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.
puzzlecracker - 30 Dec 2005 03:39 GMT
> Hi puzzlecracker:
>
[quoted text clipped - 14 lines]
>
> Mike.

Thanks... that does it

Would an automatic registering of  delegates make a language
dynamically typed?
Michael Redlich - 30 Dec 2005 18:07 GMT
Hi puzzlecracker:

> 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/default.asp?url=/library/en-us/csref/html/vcre
fTheDelegateType.asp


Hope this helps...

Happy New Year!

Mike.

--- ACGNJ Java Users Group (http://www.javasig.org/)
puzzlecracker - 30 Dec 2005 20:26 GMT
> Hi puzzlecracker:
>
[quoted text clipped - 26 lines]
>
> --- 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.