answersLogoWhite

0

Type safety is the degree to which the language prevents you from making typing errors. That is: assigning values of one type to variables of another type.

For example, in Java:

int i;

String s = "Not an integer";

i = s;

is a type error as you are trying to assign a value of type String to a variable of type int.

Java is moderately type safe as it will allow you to "type-cast" (automatically convert types) for some combinations but will give a compiler error for others.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What type of government in java?

Java has a Communist government.


How do you find out if your computer has java?

Open cmd and type java


Is java safe now?

You'll never get absolute safety - such a thing is not possible. Modern programming languages like Java are continuously improved to correct any safety problems found, but in part, safety is up to the programmer.


How do you compile your java code?

save it into a .java file. then open command prompt and navigate to your java bin directory. then type CD then your java bin directory. then type this . javac ProgName.java


Where is the java directory?

Nowhere, Just Windows-r and type "JAVA"


What is the return type of finally method in java?

The final and finally keywords have no impact on the return type of a method in Java.


What is gini in Java language?

gini is the one type of extension of the java. gini is the advanced and advanced version of the java


Enum in java?

Enum in java is a keyword which is introduced in JDK 1.5 and its a type like Interface and Class.Enum constants are implicitly static and final and you can not change there value once created. Enum in Java provides type-safety and can be used inside switch statment like int variables. Since enum is a keyword you can not use as variable name and since its only introduced in JDK 1.5 all your previous code which has enum as variable name will not work and needs to be refactored.


Which type of language is java?

Java is truly object oriented programming language


Is float is a keyword in java?

yes, float is keyword and data type in java


Is button a data type in Java?

In Java, just about anything is defined as a class; a class is a data type, so yes.


Command use on how to run a java program?

You execute it the same way you would on any other OS. As long as you have the Java Runtime Environment installed and the "java" executable is in your path, from the command line you would simply run: java -cp /path/to/file/here com.some.class.to.run.Here