I am a newbie to Java, and as an exercise wanted to WAP a simple program to print required no. of \'*\' characters according to the user. But somehow, the output of this cod
You need to parse the number received from System.in.read() or alternatively read it as an integer, currently you just cast it, so if you enter 5, it passes 0x35 times (which is the value of the character '5')
You can do, for example:
Scanner scan = new Scanner( System.in );
printstars( scan.nextInt() );