answersLogoWhite

0

Primitive java data types

Updated: 8/11/2023
User Avatar

Wiki User

12y ago

Best Answer

The primitive data types in Java are:

  • int: integer value from -232 to 232
  • float
  • double
  • long: integer value from -264 to 264
  • byte: integer value from -128 to 128
  • char: character
  • short: integer value from -32768 to 32768
  • boolean: true or false value
  • String (not actually a primitive data type)
User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Primitive java data types
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Variables as object in java?

There are two main categories of variables in Java. They are primitive and non primitive. Primitive data types are the basic data types like int, float, char etc. These are not objects. The other non primitive data types are all types of Java Objects. Example: String, ArrayList etc.


How many simple data types are there?

There are a total of 8 simple or primitive data types in Java. They are:byteshortintfloatdoublebooleanlong andString


Do the primitive datatypes in java have objects?

No Primitive data types do not have objects. As of Java 1.5, all primitive types in Java have "wrapper" classes. These classes serve two purposes: # They keep all type-specific methods together in one place. # They allow primitive types to be used in situations which take advantage of generics (also introduced in Java 1.5).


What are primitive variables?

Primitive variables are variables that are not objects and carry primitive values like numbers, boolean etc. The primitive data types in java are:intbytefloatcharlongbooleanshortdouble


Why are there both primitive and object versions of integers doubles floats characters and booleans?

Primitive data types like int, float etc are available for us to perform primitive data type operations like addition, subtraction, comparison etc. But since Java is an object oriented language, there are many features in java where such primate data types cannot be used. Only objects can be used. So for using the features of such data types there also we have wrapper classes that would create objects for these primitive data types.

Related questions

Variables as object in java?

There are two main categories of variables in Java. They are primitive and non primitive. Primitive data types are the basic data types like int, float, char etc. These are not objects. The other non primitive data types are all types of Java Objects. Example: String, ArrayList etc.


How many simple data types are there?

There are a total of 8 simple or primitive data types in Java. They are:byteshortintfloatdoublebooleanlong andString


Is Java a true object oriented language?

since Java have primitive data types, I think its not pure OO


Do the primitive datatypes in java have objects?

No Primitive data types do not have objects. As of Java 1.5, all primitive types in Java have "wrapper" classes. These classes serve two purposes: # They keep all type-specific methods together in one place. # They allow primitive types to be used in situations which take advantage of generics (also introduced in Java 1.5).


What are primitive variables?

Primitive variables are variables that are not objects and carry primitive values like numbers, boolean etc. The primitive data types in java are:intbytefloatcharlongbooleanshortdouble


Why are there both primitive and object versions of integers doubles floats characters and booleans?

Primitive data types like int, float etc are available for us to perform primitive data type operations like addition, subtraction, comparison etc. But since Java is an object oriented language, there are many features in java where such primate data types cannot be used. Only objects can be used. So for using the features of such data types there also we have wrapper classes that would create objects for these primitive data types.


Java variable types and controls?

Java is a powerful language that gives us options to have data in different forms. We have several data types that we can use for our needs. The basic data types that java offers us are termed as Primitive Data Types. Though all programming languages have varied data types java offers us with a variety of data types that are much powerful and simplified to use when compared to other languages.The Java programming language is strongly-typed, which means that all variables must first be declared before they can be used. This involves stating the variable's type and name.int age = 10;The above statement tells the java compiler that a field named "age" which holds numeric data and having an initial value of 10 is declared. A variable's data type determines the values it may contain, plus the operations that may be performed on it. In addition to int, the Java programming language supports seven other primitive data types. A primitive type is predefined by the language and is named by a reserved keyword. Primitive values do not share state with other primitive values. The eight primitive data types supported by the Java programming language are:byte, short, int, long, float, double, char and boolean


What are the Different types of data type?

Java Data TypesJava is a powerful language that gives us options to have data in different forms. We have several data types that we can use for our needs. The basic data types that java offers us are termed as Primitive Data Types. Though all programming languages have varied data types java offers us with a variety of data types that are much powerful and simplified to use when compared to other languages.The Java programming language is strongly-typed, which means that all variables must first be declared before they can be used. This involves stating the variable's type and name.int age = 10;The above statement tells the java compiler that a field named "age" which holds numeric data and having an initial value of 10 is declared. A variable's data type determines the values it may contain, plus the operations that may be performed on it. In addition to int, the Java programming language supports seven other primitive data types. A primitive type is predefined by the language and is named by a reserved keyword. Primitive values do not share state with other primitive values. The eight primitive data types supported by the Java programming language are: byte, short, int, float, double, long, char and boolean


What are fundamental data types in java?

Assuming by "fundamental" you mean the primitive data types: boolean, byte, char, short, int, long, float, and double


Is string is primitive or user defined data type?

String - is primitive data typestring - is user defined data type


Why java is purely object oriented programming language?

It is said that Java is not purely object-oriented, because of its handling of primitive data types. The reason for this is for efficiency.


What are the nine basic data types?

Byte Short Int Long Float Double Char Bool String