java - Declaring and initializing ints, error when calling constructor -
when try create new int object:
int g= new int();
netbeans tells me:
incompatible types required: int found: int[] '[' expected illegal start of expresion.
i want create new int.
for primitive datatypes dont have constructor:
int g = 5;
or
int g; //declaration
but keep in mind, there classes contain more functionallity every primitive datatype. datatypes name written first letter upper case:
integer g = new integer(5); //but needs parameter
where example have function create integer out of string:
integer.parseint("5");
but there not need them declaration part.
Comments
Post a Comment