Java is a Strongly Typed Language:-
It is important to state at the outset that Java is a strongly Typed language. Indeed,part of Java's safety and robustness comes from this fact. Let's see what
this means. First,every variable has a type, every expression has a type,and every type is strictly defined, Second, all assignments, whether explicit or via parameter passing in method c calls, are checked for type compatibility. There are no automatic corecions or conversions of conflicting types as in some languagees.The Java compile checks all expressions and parameters to ensure that the types are compatible. Any type mismatches are errors that must be corrected before the compiler will compiling the class.
The Primitive Types:-
Java Defines eight primitive types of data:
byte,short,int,long,char,float,double,and boolean. The primitive types are also commonly referred to as simple types,and both terms will be used in this book.These can be put in four groups.
* Integers:- This group includes byte,short,int and long, which are for whole-valued signed numbers.
* Floating-Point Numbers:- This group includes float and double, which represent numbers with fractional precision.
* Characters:- This group includes char,which represents symbols in a character set, like letters and numbers.
* boolean:- This group includes boolean,which ia a special type for representing true/fasle values.
The primitive types represent single values-not complex objects. Although Java is otherwise completely object-oriented, the primitive types are not. They are analogous to the simple types found in most other non-object-oriented langauges. The reason for this is efficiency. Making the primitive types into objects would have degraded performance
too much.
No comments:
Post a Comment