answersLogoWhite

0

Java variable types and controls

Updated: 12/9/2022
User Avatar

Wiki User

15y ago

Best Answer

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

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Java variable types and controls
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is native variable in java?

native is a key word used in java method. there is no variable as native in java


What are the types of motor controls?

motor can be control by using variable frequency drive


What are the types of server controls that participate in declarative data binding model?

Java sql programming


How do you initialize variable?

initialize simple types: int i = 0; initialize objects: Object o = null; (in java)


How you make shared and synchronized variable in java thread?

A Variable that is shared as well as synchronized cannot be created in Java. These two terms are mutually exclusive and a variable that is synchronized in java cannot be shared and vice versa


What is the syntax of global variable in java?

There's no global variables in Java.


What is a variable type in Java?

int


Java variables act as object or not?

How a Java variable would act depends on the variable's data type. Variables of the primitive data types like int, char, float etc would not act as objects. But apart from them, all other data types would act as Objects. Almost all data types would extend from java.lang.Object and would behave as objects.


Can you define variables in interface in java?

yes we can define a variable in an interface in java.


What is the code required to convert an integer variable to a string variable in Java?

There are several different methods to convert an integer variable to a string variable in Java. For example, one can use the following code to convert an integer variable to a string variable: Integer.toString(number)


How do you equate a php variable to a javascript variable?

Ideal thing would be to retrieve the value from PHP using AJAX and then assigning it to a java script variable. Thereafter compare it to the java script variable that is already present.


What type of a variable is an experimental controls?

independent variable