How can I read a char? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How can I read a char?

26th Nov 2016, 2:52 PM
Bergh Carvalho
Bergh Carvalho - avatar
7 Respostas
+ 7
You must creat infinitive loop and then inside loop, read string, then check string length, if was 1, get first index of string and then break loop, else continue loop for read again.I hope this helps.
26th Nov 2016, 3:58 PM
Hadi Akbarzadeh
Hadi Akbarzadeh - avatar
+ 3
i think first read the string then convert it into char.i am sure about this.
26th Nov 2016, 3:35 PM
Jawad Gorayya
Jawad Gorayya - avatar
+ 3
Import java.io.Filereader; Public class A{ Public static void main (String[] args ){ try { Filereader fr = new Filereader ("path"); fr.reader(char); }catch( Exception e){} } }
26th Nov 2016, 11:32 PM
amash
amash - avatar
+ 2
char cannot be read in java
26th Nov 2016, 3:20 PM
Jawad Gorayya
Jawad Gorayya - avatar
+ 2
You could try to read your char as byte and type cast it to char. What do you think of this idea, @Jawad?
26th Nov 2016, 3:30 PM
Andreas K
Andreas K - avatar
+ 2
Yes, to it as String should be easier. You are right.
26th Nov 2016, 3:50 PM
Andreas K
Andreas K - avatar
+ 2
charAt(i);
26th Nov 2016, 4:04 PM
Jawad Gorayya
Jawad Gorayya - avatar