answersLogoWhite

0


Best Answer

According to the JLS, the default value of an int is 0. The default value of an object of type Integer is null.

Of course, this applies only to class members fields, as local method-level fields must be explicitly assigned a value before use.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the default value of integer in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is default value of Boolean type variable?

False will be the default value of the boolean datatype in java


Primitive java data types?

The primitive data types in Java are:int: integer value from -232 to 232floatdoublelong: integer value from -264 to 264byte: integer value from -128 to 128char: charactershort: integer value from -32768 to 32768boolean: true or false valueString (not actually a primitive data type)


What is passed toward the method in java?

Java uses pass by value semantics by default.


What are the default values of different primitive types?

The default values for primitive types in Java are the following:Data TypeDefault Valuebyte0short0int0long0Lfloat0.0fdouble0.0dchar'\u0000' (or 0)String (or any object)nullbooleanfalseNote if you use the Object wrappers of primitives (e.g., Byte, Integer, Double, Float, etc.) then like any Object the default value is null.


Which method is default by true in java?

I don't understand what you mean with "default by true"? Please clarify your question. A Java method can have zero or more parameters, and it must have one return value. Any of these can be declared as "boolean", in which case the value can be either true or false.


What are the different parameter passing methods used by c plus plus?

Pass by value, constant value, reference and constant reference. Pass by value is the default in C++ (pass by reference is the default in Java).


How do you convert an int to object in java?

Java has auto-boxing introduced in Java 5 and converts ints to Integer objects as needed.Or you can explictly call Integer.valueOf(int) or new Integer(int) to return an Integer object with the value of the primitive int argument.Example:int i = 14; // i = 14Integer a = Integer.valueOf(i); // a = 14Integer b = new Integer(i); // b = 14or simplyInteger c = i;


How do I turn Java on?

Install Java. It is "on" by default.


What happens if you don't initialize an instance variable of any of the primitive type in java?

Java by default initializes it to the default value for that primitive type. Thus an int will be initialized to 0(zero), a Boolean will be initialized to false.


Why using parseInt in java?

parseInt is a method in the Integer class in java and is used to parse string values into integer numbers. ex: int i = Integer.parseInt("10"); After the above line of code, the variable i will be assigned a value of 10 which is the numeric value of the string passed as argument to the parseInt method


What is the defualt value for String in java?

The default value for objects is null; I believe this would apply to a String, too, since Strings are objects.


What Double means in java?

I think it means that an integer,value, number of some sort can be returned for the object identified.