guys, sorry again. i need some help here.
1) i trying to input a letter H into the keyboard, but i return a error of
null (until.scanner),
2) i'm trying to input a character into the screen. the screen is not executing.
try to debug it but unable to.
-------------
import java.util.Scanner;
class Q4
{
public static void main (
String[]args)
{
Scanner sc = new Scanner (System.in);
System.out.print("Enter character that you want to print:");
int x=sc.nextInt();
for (int i=1;i<=5;i++)
{
for (int j=1;j<=5;j++)
{
if (i!=3){
if (j==1 || j==5){
System.out.print("*");
}
else {
System.out.print("^");
}
}
else {
System.out.print("*");
}
}// j loop
System.out.println();
} // i loop
}
}
------------
q2
-----------
import java.util.Scanner;
class KeyBoard
{
public static void main (String[]args)
{
Scanner sc = new Scanner (System.in);
String x = sc.next();
char y= x.charAt(0);
System.out.print(" The characeter is: " +y);
}
}
------------------------------