Anonymous

What is a strong-typed language?

3 Answers

Jon Moody Profile
Jon Moody answered

A strongly-typed programming language is one in which each type of data (such as integer, character, hexadecimal, packed decimal, and so forth) is predefined as part of the programming language and all constants or variables defined for a given program must be described with one of the data types.

An advantage of strong data typing is that it imposes a rigorous set of rules on a programmer and thus guarantees a certain consistency of results. A disadvantage is that it prevents the programmer from inventing a data type not anticipated by the developers of the programming language and it limits how "creative" one can be in using a given data type.

So for a strongly-type language you can be garunteed that a variable will always have the same type of information, a variable declared as int, will always contain a number. For weak languages declaration doesn't require you to specify the data type, as the language adjusts the data type as needed. Examples:

Strong (C++)
int num = 7;
float pi = 3.14;
char letter = 'a';

Weak (Javascript)

var num = 7;
var pi = 3.14;
var person = "John Doe";

Krishan Kumar Profile
Krishan Kumar , Software Professional, answered

A strongly typed programming language, in the simplest words should require a variable to be defined before it is used. For example, Java is a strongly typed language, so every variable must be declared and initialized or assigned before it is used. A variable, in the simplest way, is declared by placing a valid type followed by the variable name. Following statements demonstrate variable declaration in Java:

byte age; //contains -128 to 127

long population;

float temperature;

double salary;

Florio Potter Profile
Florio Potter answered

A strongly-typed programming language is one in which each type of data (such as integer, character, hexadecimal, packed decimal, and so forth) is predefined as part of the programming language and all constants or variables defined for a given program must be described with one of the data types. For more information get help at CodeAvail- Online Computer Science Assignment
help

Answer Question

Anonymous