answersLogoWhite

0


Best Answer

Dependion on the variable there are several methods to do it, this can only be applied to primitive types and arrays, for an array its the "name_of_array.length", for the arraylist this change just a little, it would be like "name_of_array_list.size()", for an int, double, float, long, byte, it would be like "name_of_variable.LENGTH" this is a public variable so you dont need a get, an finally for the String there is a method "name_of_string.length()" this would return the size of this String

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

the size of int is 2 bytes.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

In Java, an int requires 4 bytes.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

4 Bytes

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

4 bytes.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the function in java to find the size of given variable?
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 is instant variable in java?

objects whose properties are different instance datamember n member function are use for that


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


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.


Can a java program has two different variable?

Yes. You can have as many variables as you want in Java


Which math function is used to find the square root of a number using java?

Math.sqrt(number) function is used to find the square root of a number.. try it


What is function in java terminology?

In Java, a function is called a "method". In Java as well as other languages, a method is a function defined specifically for one class. In Java, this is the only way to define functions, therefore, all functions are methods.In Java, a function is called a "method". In Java as well as other languages, a method is a function defined specifically for one class. In Java, this is the only way to define functions, therefore, all functions are methods.In Java, a function is called a "method". In Java as well as other languages, a method is a function defined specifically for one class. In Java, this is the only way to define functions, therefore, all functions are methods.In Java, a function is called a "method". In Java as well as other languages, a method is a function defined specifically for one class. In Java, this is the only way to define functions, therefore, all functions are methods.


What is instance variable in java?

That refers to a variable attached to an object - also known as a field.