Using a variable to set an object array in java -


when set object array such as:

player[] player = new player[amountofplayers]; 

i use:

amountofplayers = br.read(); 

to variable amountofplayers. whenever run program type in 3 when asked set amountofplayers output says there 51 players.

though when set new player array to: new player[3]; works.

anyone know why be?

the problem read char , interpret integer. character 3 has ascii code 51.

it easier use scanner bufferedreader read input, suggested prasad.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -