The answer to the question was EDITED :
There is no type of auto variable in Java. The same cycle can be achieved as:
for ( Object var : object_array) System.out.println(var);
Java has local variables, the scope of which is inside the block where they were defined. Like C and C ++, but there is no auto or register keyword. However, the Java compiler will not allow the use of an implicitly initialized local variable and will give a compilation error (unlike C and C ++, where the compiler usually only warns). Courtesy: Wikipedia .
No, Java does not have any basic output type, such as C ++. There was an RFE , but it was closed as "Do not fix", the reason was:
People benefit from type redundancy in two ways. First, the redundant type serves as valuable documentation - readers should not look for the getMap () declaration to find out which type is being returned. Secondly, redundancy allows the programmer to declare the type and, therefore, take advantage of the cross-validation performed by the compiler.
NINCOMPOOP Apr 21 '13 at 15:28 2013-04-21 15:28
source share