I read on a book about networks that class A has 16777214 hosts and 127 subnets,my question is: how they obtain the 127 number?
The A class networks space corresponds to all IP addresses with the first bit set to 0, i.e. IPs from 0.0.0.0 to 127.255.255.255, i.e. the class A subnets from 0.0.0.0/8 to 127.0.0.0/8.
Since 0.0.0.0/8 is reserved by the protocol (see RFC1122, section 188.8.131.52 for details) you are left with the subnets from 184.108.40.206/8 to 127.0.0.0/8.
Anyway, classful routing is interesting only for historical reasons and is not relevant in any way to how modern network devices work.