Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 141279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:45:04+00:00 2026-05-11T07:45:04+00:00

Are there any other ways of changing a variable’s type in a statically typed

  • 0

Are there any other ways of changing a variable’s type in a statically typed language like Java and C++, except ‘casting’?

I’m trying to figure out what the main difference is in practical terms between dynamic and static typing and keep finding very academic definitions. I’m wondering what it means in terms of what my code looks like.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:45:04+00:00Added an answer on May 11, 2026 at 7:45 am

    Make sure you don’t get static vs. dynamic typing confused with strong vs. weak typing.

    • Static typing: Each variable, method parameter, return type etc. has a type known at compile time, either declared or inferred.
    • Dynamic typing: types are ignored/don’t exist at compile time
    • Strong typing: each object at runtime has a specific type, and you can only perform those operations on it that are defined for that type.
    • Weak typing: runtime objects either don’t have an explicit type, or the system attempts to automatically convert types wherever necessary.

    These two opposites can be combined freely:

    • Java is statically and strongly typed
    • C is statically and weakly typed (pointer arithmetics!)
    • Ruby is dynamically and strongly typed
    • JavaScript is dynamically and weakly typed

    Genrally, static typing means that a lot of errors are caught by the compiler which are runtime errors in a dynamically typed language – but it also means that you spend a lot of time worrying about types, in many cases unnecessarily (see interfaces vs. duck typing).

    Strong typing means that any conversion between types must be explicit, either through a cast or through the use of conversion methods (e.g. parsing a string into an integer). This means more typing work, but has the advantage of keeping you in control of things, whereas weak typing often results in confusion when the system does some obscure implicit conversion that leaves you with a completely wrong variable value that causes havoc ten method calls down the line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any other ways to make it another way than with closure and
Is there any other better way to fill up the array like : var
Is there any other method that is faster than doing like this? private void
Is there any other way in java to implement call backs apart from inner
Is there any other implementation (e.g. in an OSS project) of a Java SecurityManager
Are there any other ways to set attributes for models in Rails other than
is there any other ways? here are my desired code in between of my
I know about these. Is there any other ways as well? And which one
s/(?P<head>\[\[foo[^\[]*)abc/\g<head>def s/(?=\[\[foo[^\[]*)abc/def Which is more efficient? Are there any other ways to make it
Are there any other ways besides the one below to validate query parameter values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.