answersLogoWhite

0

What are primitive variables?

Updated: 10/31/2022
User Avatar

Wiki User

14y ago

Best Answer

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

  • int
  • byte
  • float
  • char
  • long
  • boolean
  • short
  • double
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are primitive variables?
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.


Can you store non primitive data type in the array list?

Yes you can store non primitive data type variables in an array. String is a non primitive data type. You can declare a string array as: String a[]=new String[10];


What is a variables in java?

A variable in java is something that holds a value and has a name attached to it. This value can change and hence its named a variable.There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.


What are the data types in java?

There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.


What are the types of non primitive in java?

There are 8 primitive data types: byte, short, int, long, float, double, boolean, charany other data type in Java can be considered non primitive data type.Ex: StringString data type can also be known as the primitive data type because it is already provided by the Java language, since it is not a data type but its a class, but as we know that we can use the classes as types for the variables/instance variables, as we use while creating an object of any class, hence the classes that we create and use them as a datatype are known as non-primitive datatype....for any query, mail me on engineer.sooraj@gmail.com or call me on +92-331-350-6956.....

Related questions

What is primitive variables?

variable declared with primitive datatype are called as primitive variable. ex: short s=12; char ch='a'; here in above case ch,s are declared with primitive datatype of short and char so it is called as primitive variables.. thanx, from rajesh adepu.


Are primitive methods and class level variables the same in Java?

No, they are not.


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.


What is the kinds of variables?

There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.


Can you store non primitive data type in the array list?

Yes you can store non primitive data type variables in an array. String is a non primitive data type. You can declare a string array as: String a[]=new String[10];


How are variables created?

Primitive data type variables can be created like below: int a; float b; Objects must be created using the "new" keyword Ex: ArrayList lst = new ArrayList();


What are two kinds of variables?

There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.


What is a variables in java?

A variable in java is something that holds a value and has a name attached to it. This value can change and hence its named a variable.There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.


What are the data types in java?

There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.


Why you write a string with S capital?

A String in Java is an object, just like an Integer, which means creating them calls their class file, which has to be capitalized. Variables like int and float are primitive variables, meaning an object isn't created to hold them, so they aren't capitalized.


What are the types of non primitive in java?

There are 8 primitive data types: byte, short, int, long, float, double, boolean, charany other data type in Java can be considered non primitive data type.Ex: StringString data type can also be known as the primitive data type because it is already provided by the Java language, since it is not a data type but its a class, but as we know that we can use the classes as types for the variables/instance variables, as we use while creating an object of any class, hence the classes that we create and use them as a datatype are known as non-primitive datatype....for any query, mail me on engineer.sooraj@gmail.com or call me on +92-331-350-6956.....


What are java variables?

It is something that holds a value. ex: string holds text. char holds one character. integer holds numbers. etc They can be declared by... string myWords = "Hello, World!"; System.out.println(myWords); This code will make a console say whatever is inside of that variable, which happens to be: "Hello, World!".